1 #include <rust_types.h>
6 // These should be provided...somehow...
7 void *memset(void *s, int c, size_t n);
8 void *memcpy(void *dest, const void *src, size_t n);
9 int memcmp(const void *s1, const void *s2, size_t n);
11 void __attribute__((noreturn)) abort(void);
12 void assert(bool expression);
14 // Always run a, then assert it is true:
15 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
16 // Assert a is true or do nothing
17 #define CHECK(a) DO_ASSERT(a)
19 // Running a leak check across all the allocations and frees of the JDK is a mess,
20 // so instead we implement our own naive leak checker here, relying on the -wrap
21 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
22 // and free'd in Rust or C across the generated bindings shared library.
25 typedef struct allocation {
26 struct allocation* next;
28 const char* struct_name;
30 static allocation* allocation_ll = NULL;
32 void* __real_malloc(size_t len);
33 void* __real_calloc(size_t nmemb, size_t len);
34 static void new_allocation(void* res, const char* struct_name) {
35 allocation* new_alloc = __real_malloc(sizeof(allocation));
37 new_alloc->struct_name = struct_name;
38 new_alloc->next = allocation_ll;
39 allocation_ll = new_alloc;
41 static void* MALLOC(size_t len, const char* struct_name) {
42 void* res = __real_malloc(len);
43 new_allocation(res, struct_name);
46 void __real_free(void* ptr);
47 static void alloc_freed(void* ptr) {
49 allocation* it = allocation_ll;
50 while (it->ptr != ptr) {
51 p = it; it = it->next;
53 //XXX: fprintf(stderr, "Tried to free unknown pointer %p\n", ptr);
54 return; // addrsan should catch malloc-unknown and print more info than we have
57 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
58 DO_ASSERT(it->ptr == ptr);
61 static void FREE(void* ptr) {
62 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
67 void* __wrap_malloc(size_t len) {
68 void* res = __real_malloc(len);
69 new_allocation(res, "malloc call");
72 void* __wrap_calloc(size_t nmemb, size_t len) {
73 void* res = __real_calloc(nmemb, len);
74 new_allocation(res, "calloc call");
77 void __wrap_free(void* ptr) {
78 if (ptr == NULL) return;
83 void* __real_realloc(void* ptr, size_t newlen);
84 void* __wrap_realloc(void* ptr, size_t len) {
85 if (ptr != NULL) alloc_freed(ptr);
86 void* res = __real_realloc(ptr, len);
87 new_allocation(res, "realloc call");
90 void __wrap_reallocarray(void* ptr, size_t new_sz) {
91 // Rust doesn't seem to use reallocarray currently
95 void __attribute__((destructor)) check_leaks() {
96 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
97 //XXX: fprintf(stderr, "%s %p remains\n", a->struct_name, a->ptr);
99 DO_ASSERT(allocation_ll == NULL);
102 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
103 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
105 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
109 typedef struct int64_tArray { uint32_t *len; /* len + 1 is data */ } int64_tArray;
110 typedef struct uint32_tArray { uint32_t *len; /* len + 1 is data */ } uint32_tArray;
111 typedef struct ptrArray { uint32_t *len; /* len + 1 is data */ } ptrArray;
112 typedef struct int8_tArray { uint32_t *len; /* len + 1 is data */ } int8_tArray;
113 typedef struct jstring {} jstring;
115 jstring conv_owned_string(const char* _src) { jstring a; return a; }
117 typedef bool jboolean;
119 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
120 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
122 case 0: return LDKAccessError_UnknownChain;
123 case 1: return LDKAccessError_UnknownTx;
127 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
129 case LDKAccessError_UnknownChain: return 0;
130 case LDKAccessError_UnknownTx: return 1;
134 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
136 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
137 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
141 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
143 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
144 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
148 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
150 case 0: return LDKConfirmationTarget_Background;
151 case 1: return LDKConfirmationTarget_Normal;
152 case 2: return LDKConfirmationTarget_HighPriority;
156 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
158 case LDKConfirmationTarget_Background: return 0;
159 case LDKConfirmationTarget_Normal: return 1;
160 case LDKConfirmationTarget_HighPriority: return 2;
164 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
166 case 0: return LDKLevel_Off;
167 case 1: return LDKLevel_Error;
168 case 2: return LDKLevel_Warn;
169 case 3: return LDKLevel_Info;
170 case 4: return LDKLevel_Debug;
171 case 5: return LDKLevel_Trace;
175 static inline int32_t LDKLevel_to_js(LDKLevel val) {
177 case LDKLevel_Off: return 0;
178 case LDKLevel_Error: return 1;
179 case LDKLevel_Warn: return 2;
180 case LDKLevel_Info: return 3;
181 case LDKLevel_Debug: return 4;
182 case LDKLevel_Trace: return 5;
186 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
188 case 0: return LDKNetwork_Bitcoin;
189 case 1: return LDKNetwork_Testnet;
190 case 2: return LDKNetwork_Regtest;
194 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
196 case LDKNetwork_Bitcoin: return 0;
197 case LDKNetwork_Testnet: return 1;
198 case LDKNetwork_Regtest: return 2;
202 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
204 case 0: return LDKSecp256k1Error_IncorrectSignature;
205 case 1: return LDKSecp256k1Error_InvalidMessage;
206 case 2: return LDKSecp256k1Error_InvalidPublicKey;
207 case 3: return LDKSecp256k1Error_InvalidSignature;
208 case 4: return LDKSecp256k1Error_InvalidSecretKey;
209 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
210 case 6: return LDKSecp256k1Error_InvalidTweak;
211 case 7: return LDKSecp256k1Error_NotEnoughMemory;
212 case 8: return LDKSecp256k1Error_CallbackPanicked;
216 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
218 case LDKSecp256k1Error_IncorrectSignature: return 0;
219 case LDKSecp256k1Error_InvalidMessage: return 1;
220 case LDKSecp256k1Error_InvalidPublicKey: return 2;
221 case LDKSecp256k1Error_InvalidSignature: return 3;
222 case LDKSecp256k1Error_InvalidSecretKey: return 4;
223 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
224 case LDKSecp256k1Error_InvalidTweak: return 6;
225 case LDKSecp256k1Error_NotEnoughMemory: return 7;
226 case LDKSecp256k1Error_CallbackPanicked: return 8;
230 uint32_t LDKCVec_1u8Z_1new(void* ctx_TODO, int8_tArray elems) {
231 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
232 ret->datalen = *elems.len;
233 if (ret->datalen == 0) {
236 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
237 int8_t *java_elems = (int8_t*)(elems.len + 1);
238 for (size_t i = 0; i < ret->datalen; i++) {
239 ret->data[i] = java_elems[i];
244 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
245 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
246 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
249 uint32_t LDKC2Tuple_1u64u64Z_1new(void* ctx_TODO, int64_t a, int64_t b) {
250 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
255 static inline LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const LDKC2Tuple_u64u64Z *orig) {
256 LDKC2Tuple_u64u64Z ret = {
262 int64_t LDKC2Tuple_1u64u64Z_1get_1a(void* ctx_TODO, uint32_t ptr) {
263 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
266 int64_t LDKC2Tuple_1u64u64Z_1get_1b(void* ctx_TODO, uint32_t ptr) {
267 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
270 uint32_t LDKSpendableOutputDescriptor_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
271 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
273 case LDKSpendableOutputDescriptor_StaticOutput: {
274 LDKOutPoint outpoint_var = obj->static_output.outpoint;
275 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
276 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
277 long outpoint_ref = (long)outpoint_var.inner & ~1;
278 long output_ref = (long)&obj->static_output.output;
279 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
281 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
282 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
283 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
284 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
285 long outpoint_ref = (long)outpoint_var.inner & ~1;
286 int8_tArray per_commitment_point_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
287 memcpy(per_commitment_point_arr.len + 1, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form, 33);
288 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
289 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
290 int8_tArray revocation_pubkey_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
291 memcpy(revocation_pubkey_arr.len + 1, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form, 33);
292 return 0 /* LDKSpendableOutputDescriptor - DynamicOutputP2WSH */; (void) outpoint_ref; (void) per_commitment_point_arr; (void) obj->dynamic_output_p2wsh.to_self_delay; (void) (long)output_ref; (void) key_derivation_params_ref; (void) revocation_pubkey_arr;
294 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
295 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
296 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
297 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
298 long outpoint_ref = (long)outpoint_var.inner & ~1;
299 long output_ref = (long)&obj->static_output_counterparty_payment.output;
300 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
301 return 0 /* LDKSpendableOutputDescriptor - StaticOutputCounterpartyPayment */; (void) outpoint_ref; (void) (long)output_ref; (void) key_derivation_params_ref;
306 uint32_t LDKCVec_1SpendableOutputDescriptorZ_1new(void* ctx_TODO, uint32_tArray elems) {
307 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
308 ret->datalen = *elems.len;
309 if (ret->datalen == 0) {
312 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
313 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
314 for (size_t i = 0; i < ret->datalen; i++) {
315 uint32_t arr_elem = java_elems[i];
316 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
317 FREE((void*)arr_elem);
318 ret->data[i] = arr_elem_conv;
323 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
324 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
325 for (size_t i = 0; i < ret.datalen; i++) {
326 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
330 uint32_t LDKErrorAction_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
331 LDKErrorAction *obj = (LDKErrorAction*)ptr;
333 case LDKErrorAction_DisconnectPeer: {
334 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
335 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
336 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
337 long msg_ref = (long)msg_var.inner & ~1;
338 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
340 case LDKErrorAction_IgnoreError: {
341 return 0 /* LDKErrorAction - IgnoreError */;
343 case LDKErrorAction_SendErrorMessage: {
344 LDKErrorMessage msg_var = obj->send_error_message.msg;
345 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
346 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
347 long msg_ref = (long)msg_var.inner & ~1;
348 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
353 uint32_t LDKHTLCFailChannelUpdate_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
354 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
356 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
357 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
358 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
359 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
360 long msg_ref = (long)msg_var.inner & ~1;
361 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
363 case LDKHTLCFailChannelUpdate_ChannelClosed: {
364 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
366 case LDKHTLCFailChannelUpdate_NodeFailure: {
367 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
368 memcpy(node_id_arr.len + 1, obj->node_failure.node_id.compressed_form, 33);
369 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
374 uint32_t LDKMessageSendEvent_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
375 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
377 case LDKMessageSendEvent_SendAcceptChannel: {
378 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
379 memcpy(node_id_arr.len + 1, obj->send_accept_channel.node_id.compressed_form, 33);
380 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
381 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
382 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
383 long msg_ref = (long)msg_var.inner & ~1;
384 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
386 case LDKMessageSendEvent_SendOpenChannel: {
387 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
388 memcpy(node_id_arr.len + 1, obj->send_open_channel.node_id.compressed_form, 33);
389 LDKOpenChannel msg_var = obj->send_open_channel.msg;
390 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
391 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
392 long msg_ref = (long)msg_var.inner & ~1;
393 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
395 case LDKMessageSendEvent_SendFundingCreated: {
396 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
397 memcpy(node_id_arr.len + 1, obj->send_funding_created.node_id.compressed_form, 33);
398 LDKFundingCreated msg_var = obj->send_funding_created.msg;
399 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
400 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
401 long msg_ref = (long)msg_var.inner & ~1;
402 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
404 case LDKMessageSendEvent_SendFundingSigned: {
405 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
406 memcpy(node_id_arr.len + 1, obj->send_funding_signed.node_id.compressed_form, 33);
407 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
408 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
409 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
410 long msg_ref = (long)msg_var.inner & ~1;
411 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
413 case LDKMessageSendEvent_SendFundingLocked: {
414 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
415 memcpy(node_id_arr.len + 1, obj->send_funding_locked.node_id.compressed_form, 33);
416 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
417 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
418 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
419 long msg_ref = (long)msg_var.inner & ~1;
420 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
422 case LDKMessageSendEvent_SendAnnouncementSignatures: {
423 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
424 memcpy(node_id_arr.len + 1, obj->send_announcement_signatures.node_id.compressed_form, 33);
425 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
426 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
427 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
428 long msg_ref = (long)msg_var.inner & ~1;
429 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
431 case LDKMessageSendEvent_UpdateHTLCs: {
432 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
433 memcpy(node_id_arr.len + 1, obj->update_htl_cs.node_id.compressed_form, 33);
434 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
435 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
436 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
437 long updates_ref = (long)updates_var.inner & ~1;
438 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
440 case LDKMessageSendEvent_SendRevokeAndACK: {
441 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
442 memcpy(node_id_arr.len + 1, obj->send_revoke_and_ack.node_id.compressed_form, 33);
443 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
444 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
445 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
446 long msg_ref = (long)msg_var.inner & ~1;
447 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
449 case LDKMessageSendEvent_SendClosingSigned: {
450 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
451 memcpy(node_id_arr.len + 1, obj->send_closing_signed.node_id.compressed_form, 33);
452 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
453 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
454 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
455 long msg_ref = (long)msg_var.inner & ~1;
456 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
458 case LDKMessageSendEvent_SendShutdown: {
459 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
460 memcpy(node_id_arr.len + 1, obj->send_shutdown.node_id.compressed_form, 33);
461 LDKShutdown msg_var = obj->send_shutdown.msg;
462 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
463 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
464 long msg_ref = (long)msg_var.inner & ~1;
465 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
467 case LDKMessageSendEvent_SendChannelReestablish: {
468 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
469 memcpy(node_id_arr.len + 1, obj->send_channel_reestablish.node_id.compressed_form, 33);
470 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
471 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
472 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
473 long msg_ref = (long)msg_var.inner & ~1;
474 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
476 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
477 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
478 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
479 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
480 long msg_ref = (long)msg_var.inner & ~1;
481 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
482 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
483 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
484 long update_msg_ref = (long)update_msg_var.inner & ~1;
485 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
487 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
488 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
489 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
490 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
491 long msg_ref = (long)msg_var.inner & ~1;
492 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
494 case LDKMessageSendEvent_BroadcastChannelUpdate: {
495 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
496 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
497 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
498 long msg_ref = (long)msg_var.inner & ~1;
499 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
501 case LDKMessageSendEvent_HandleError: {
502 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
503 memcpy(node_id_arr.len + 1, obj->handle_error.node_id.compressed_form, 33);
504 long action_ref = (long)&obj->handle_error.action;
505 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
507 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
508 long update_ref = (long)&obj->payment_failure_network_update.update;
509 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
511 case LDKMessageSendEvent_SendChannelRangeQuery: {
512 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
513 memcpy(node_id_arr.len + 1, obj->send_channel_range_query.node_id.compressed_form, 33);
514 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
515 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
516 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
517 long msg_ref = (long)msg_var.inner & ~1;
518 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
520 case LDKMessageSendEvent_SendShortIdsQuery: {
521 int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
522 memcpy(node_id_arr.len + 1, obj->send_short_ids_query.node_id.compressed_form, 33);
523 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
524 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
525 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
526 long msg_ref = (long)msg_var.inner & ~1;
527 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
532 uint32_t LDKCVec_1MessageSendEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
533 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
534 ret->datalen = *elems.len;
535 if (ret->datalen == 0) {
538 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
539 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
540 for (size_t i = 0; i < ret->datalen; i++) {
541 uint32_t arr_elem = java_elems[i];
542 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
543 FREE((void*)arr_elem);
544 ret->data[i] = arr_elem_conv;
549 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
550 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
551 for (size_t i = 0; i < ret.datalen; i++) {
552 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
556 uint32_t LDKEvent_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
557 LDKEvent *obj = (LDKEvent*)ptr;
559 case LDKEvent_FundingGenerationReady: {
560 int8_tArray temporary_channel_id_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
561 memcpy(temporary_channel_id_arr.len + 1, obj->funding_generation_ready.temporary_channel_id.data, 32);
562 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
563 int8_tArray output_script_arr = { .len = MALLOC(output_script_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
564 memcpy(output_script_arr.len + 1, output_script_var.data, output_script_var.datalen);
565 return 0 /* LDKEvent - FundingGenerationReady */; (void) temporary_channel_id_arr; (void) obj->funding_generation_ready.channel_value_satoshis; (void) output_script_arr; (void) obj->funding_generation_ready.user_channel_id;
567 case LDKEvent_FundingBroadcastSafe: {
568 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
569 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
570 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
571 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
572 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
574 case LDKEvent_PaymentReceived: {
575 int8_tArray payment_hash_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
576 memcpy(payment_hash_arr.len + 1, obj->payment_received.payment_hash.data, 32);
577 int8_tArray payment_secret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
578 memcpy(payment_secret_arr.len + 1, obj->payment_received.payment_secret.data, 32);
579 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
581 case LDKEvent_PaymentSent: {
582 int8_tArray payment_preimage_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
583 memcpy(payment_preimage_arr.len + 1, obj->payment_sent.payment_preimage.data, 32);
584 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
586 case LDKEvent_PaymentFailed: {
587 int8_tArray payment_hash_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
588 memcpy(payment_hash_arr.len + 1, obj->payment_failed.payment_hash.data, 32);
589 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
591 case LDKEvent_PendingHTLCsForwardable: {
592 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
594 case LDKEvent_SpendableOutputs: {
595 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
596 uint32_tArray outputs_arr = { .len = MALLOC(outputs_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
597 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr.len + 1);
598 for (size_t b = 0; b < outputs_var.datalen; b++) {
599 long arr_conv_27_ref = (long)&outputs_var.data[b];
600 outputs_arr_ptr[b] = arr_conv_27_ref;
602 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
607 uint32_t LDKCVec_1EventZ_1new(void* ctx_TODO, uint32_tArray elems) {
608 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
609 ret->datalen = *elems.len;
610 if (ret->datalen == 0) {
613 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
614 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
615 for (size_t i = 0; i < ret->datalen; i++) {
616 uint32_t arr_elem = java_elems[i];
617 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
618 FREE((void*)arr_elem);
619 ret->data[i] = arr_elem_conv;
624 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
625 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
626 for (size_t i = 0; i < ret.datalen; i++) {
627 ret.data[i] = Event_clone(&orig->data[i]);
631 uint32_t LDKC2Tuple_1usizeTransactionZ_1new(void* ctx_TODO, intptr_t a, int8_tArray b) {
632 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
634 LDKTransaction b_ref;
635 b_ref.datalen = *b.len;
636 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
637 memcpy(b_ref.data, b.len + 1, b_ref.datalen);
638 b_ref.data_is_owned = false;
642 intptr_t LDKC2Tuple_1usizeTransactionZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
643 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
646 int8_tArray LDKC2Tuple_1usizeTransactionZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
647 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
648 LDKTransaction b_var = tuple->b;
649 int8_tArray b_arr = { .len = MALLOC(b_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
650 memcpy(b_arr.len + 1, b_var.data, b_var.datalen);
653 uint32_t LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(void* ctx_TODO, uint32_tArray elems) {
654 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
655 ret->datalen = *elems.len;
656 if (ret->datalen == 0) {
659 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
660 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
661 for (size_t i = 0; i < ret->datalen; i++) {
662 uint32_t arr_elem = java_elems[i];
663 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_elem;
664 FREE((void*)arr_elem);
665 ret->data[i] = arr_elem_conv;
670 jboolean LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
671 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
673 void LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
674 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
675 CHECK(val->result_ok);
676 return *val->contents.result;
678 uint32_t LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (void* ctx_TODO, uint32_t arg) {
679 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
680 CHECK(!val->result_ok);
681 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
684 static inline LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const LDKCResult_NoneChannelMonitorUpdateErrZ *orig) {
685 LDKCResult_NoneChannelMonitorUpdateErrZ res = { .result_ok = orig->result_ok };
686 if (orig->result_ok) {
687 res.contents.result = NULL;
689 LDKChannelMonitorUpdateErr* contents = MALLOC(sizeof(LDKChannelMonitorUpdateErr), "LDKChannelMonitorUpdateErr result Err clone");
690 *contents = ChannelMonitorUpdateErr_clone(orig->contents.err);
691 res.contents.err = contents;
695 uint32_t LDKCVec_1MonitorEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
696 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
697 ret->datalen = *elems.len;
698 if (ret->datalen == 0) {
701 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
702 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
703 for (size_t i = 0; i < ret->datalen; i++) {
704 uint32_t arr_elem = java_elems[i];
705 LDKMonitorEvent arr_elem_conv;
706 arr_elem_conv.inner = (void*)(arr_elem & (~1));
707 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
708 if (arr_elem_conv.inner != NULL)
709 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
710 ret->data[i] = arr_elem_conv;
715 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
716 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
717 for (size_t i = 0; i < ret.datalen; i++) {
718 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
722 jboolean LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
723 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
725 uint32_t LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
726 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
727 CHECK(val->result_ok);
728 LDKChannelMonitorUpdate res_var = (*val->contents.result);
729 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
730 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
731 long res_ref = (long)res_var.inner & ~1;
734 uint32_t LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
735 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
736 CHECK(!val->result_ok);
737 LDKDecodeError err_var = (*val->contents.err);
738 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
739 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
740 long err_ref = (long)err_var.inner & ~1;
743 jboolean LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
744 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
746 void LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
747 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
748 CHECK(val->result_ok);
749 return *val->contents.result;
751 uint32_t LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
752 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
753 CHECK(!val->result_ok);
754 LDKMonitorUpdateError err_var = (*val->contents.err);
755 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
756 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
757 long err_ref = (long)err_var.inner & ~1;
760 uint32_t LDKC2Tuple_1OutPointScriptZ_1new(void* ctx_TODO, uint32_t a, int8_tArray b) {
761 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
763 a_conv.inner = (void*)(a & (~1));
764 a_conv.is_owned = (a & 1) || (a == 0);
765 if (a_conv.inner != NULL)
766 a_conv = OutPoint_clone(&a_conv);
769 b_ref.datalen = *b.len;
770 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
771 memcpy(b_ref.data, b.len + 1, b_ref.datalen);
775 static inline LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const LDKC2Tuple_OutPointScriptZ *orig) {
776 LDKC2Tuple_OutPointScriptZ ret = {
777 .a = OutPoint_clone(&orig->a),
778 .b = CVec_u8Z_clone(&orig->b),
782 uint32_t LDKC2Tuple_1OutPointScriptZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
783 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
784 LDKOutPoint a_var = tuple->a;
785 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
786 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
787 long a_ref = (long)a_var.inner & ~1;
790 int8_tArray LDKC2Tuple_1OutPointScriptZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
791 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
792 LDKCVec_u8Z b_var = tuple->b;
793 int8_tArray b_arr = { .len = MALLOC(b_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
794 memcpy(b_arr.len + 1, b_var.data, b_var.datalen);
797 uint32_t LDKC2Tuple_1u32TxOutZ_1new(void* ctx_TODO, int32_t a, uint32_t b) {
798 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
800 LDKTxOut b_conv = *(LDKTxOut*)b;
805 int32_t LDKC2Tuple_1u32TxOutZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
806 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
809 uint32_t LDKC2Tuple_1u32TxOutZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
810 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
811 long b_ref = (long)&tuple->b;
814 uint32_t LDKCVec_1C2Tuple_1u32TxOutZZ_1new(void* ctx_TODO, uint32_tArray elems) {
815 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
816 ret->datalen = *elems.len;
817 if (ret->datalen == 0) {
820 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
821 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
822 for (size_t i = 0; i < ret->datalen; i++) {
823 uint32_t arr_elem = java_elems[i];
824 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)arr_elem;
825 FREE((void*)arr_elem);
826 ret->data[i] = arr_elem_conv;
831 uint32_t LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
832 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
833 LDKThirtyTwoBytes a_ref;
835 memcpy(a_ref.data, a.len + 1, 32);
837 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
838 b_constr.datalen = *b.len;
839 if (b_constr.datalen > 0)
840 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
842 b_constr.data = NULL;
843 uint32_t* b_vals = (uint32_t*)(b.len + 1);
844 for (size_t z = 0; z < b_constr.datalen; z++) {
845 uint32_t arr_conv_25 = b_vals[z];
846 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
847 FREE((void*)arr_conv_25);
848 b_constr.data[z] = arr_conv_25_conv;
853 int8_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
854 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
855 int8_tArray a_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
856 memcpy(a_arr.len + 1, tuple->a.data, 32);
859 uint32_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
860 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
861 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
862 uint32_tArray b_arr = { .len = MALLOC(b_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
863 uint32_t *b_arr_ptr = (uint32_t*)(b_arr.len + 1);
864 for (size_t z = 0; z < b_var.datalen; z++) {
865 long arr_conv_25_ref = (long)&b_var.data[z];
866 b_arr_ptr[z] = arr_conv_25_ref;
870 uint32_t LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(void* ctx_TODO, uint32_tArray elems) {
871 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
872 ret->datalen = *elems.len;
873 if (ret->datalen == 0) {
876 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
877 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
878 for (size_t i = 0; i < ret->datalen; i++) {
879 uint32_t arr_elem = java_elems[i];
880 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_elem;
881 FREE((void*)arr_elem);
882 ret->data[i] = arr_elem_conv;
887 uint32_t LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, ptrArray b) {
888 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
891 memcpy(a_ref.compact_form, a.len + 1, 64);
893 LDKCVec_SignatureZ b_constr;
894 b_constr.datalen = *b.len;
895 if (b_constr.datalen > 0)
896 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
898 b_constr.data = NULL;
899 int8_tArray* b_vals = (int8_tArray*)(b.len + 1);
900 for (size_t m = 0; m < b_constr.datalen; m++) {
901 int8_tArray arr_conv_12 = b_vals[m];
902 LDKSignature arr_conv_12_ref;
903 CHECK(*arr_conv_12.len == 64);
904 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
905 b_constr.data[m] = arr_conv_12_ref;
910 int8_tArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
911 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
912 int8_tArray a_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
913 memcpy(a_arr.len + 1, tuple->a.compact_form, 64);
916 ptrArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
917 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
918 LDKCVec_SignatureZ b_var = tuple->b;
919 ptrArray b_arr = { .len = MALLOC(b_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
920 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr.len + 1);
921 for (size_t m = 0; m < b_var.datalen; m++) {
922 int8_tArray arr_conv_12_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
923 memcpy(arr_conv_12_arr.len + 1, b_var.data[m].compact_form, 64);
924 b_arr_ptr[m] = arr_conv_12_arr;
928 jboolean LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
929 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
931 uint32_t LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
932 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
933 CHECK(val->result_ok);
934 long res_ref = (long)&(*val->contents.result);
937 void LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
938 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
939 CHECK(!val->result_ok);
940 return *val->contents.err;
942 jboolean LDKCResult_1SignatureNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
943 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
945 int8_tArray LDKCResult_1SignatureNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
946 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
947 CHECK(val->result_ok);
948 int8_tArray res_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
949 memcpy(res_arr.len + 1, (*val->contents.result).compact_form, 64);
952 void LDKCResult_1SignatureNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
953 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
954 CHECK(!val->result_ok);
955 return *val->contents.err;
957 jboolean LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
958 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
960 ptrArray LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
961 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
962 CHECK(val->result_ok);
963 LDKCVec_SignatureZ res_var = (*val->contents.result);
964 ptrArray res_arr = { .len = MALLOC(res_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
965 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr.len + 1);
966 for (size_t m = 0; m < res_var.datalen; m++) {
967 int8_tArray arr_conv_12_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
968 memcpy(arr_conv_12_arr.len + 1, res_var.data[m].compact_form, 64);
969 res_arr_ptr[m] = arr_conv_12_arr;
973 void LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
974 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
975 CHECK(!val->result_ok);
976 return *val->contents.err;
978 typedef struct LDKChannelKeys_JCalls {
979 atomic_size_t refcnt;
980 // TODO: Object pointer o;
981 // TODO: Some kind of method pointer get_per_commitment_point_meth;
982 // TODO: Some kind of method pointer release_commitment_secret_meth;
983 // TODO: Some kind of method pointer key_derivation_params_meth;
984 // TODO: Some kind of method pointer sign_counterparty_commitment_meth;
985 // TODO: Some kind of method pointer sign_holder_commitment_meth;
986 // TODO: Some kind of method pointer sign_holder_commitment_htlc_transactions_meth;
987 // TODO: Some kind of method pointer sign_justice_transaction_meth;
988 // TODO: Some kind of method pointer sign_counterparty_htlc_transaction_meth;
989 // TODO: Some kind of method pointer sign_closing_transaction_meth;
990 // TODO: Some kind of method pointer sign_channel_announcement_meth;
991 // TODO: Some kind of method pointer ready_channel_meth;
992 // TODO: Some kind of method pointer write_meth;
993 } LDKChannelKeys_JCalls;
994 static void LDKChannelKeys_JCalls_free(void* this_arg) {
995 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
996 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
997 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1001 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1002 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1003 //TODO: jobject obj = get object we can call against on j_calls->o
1004 int8_tArray arg; // TODO: Call get_per_commitment_point on j_calls with instance obj, returning an object, idx);
1005 LDKPublicKey arg_ref;
1006 CHECK(*arg.len == 33);
1007 memcpy(arg_ref.compressed_form, arg.len + 1, 33);
1010 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1011 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1012 //TODO: jobject obj = get object we can call against on j_calls->o
1013 int8_tArray arg; // TODO: Call release_commitment_secret on j_calls with instance obj, returning an object, idx);
1014 LDKThirtyTwoBytes arg_ref;
1015 CHECK(*arg.len == 32);
1016 memcpy(arg_ref.data, arg.len + 1, 32);
1019 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1020 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1021 //TODO: jobject obj = get object we can call against on j_calls->o
1022 LDKC2Tuple_u64u64Z* ret; // TODO: Call key_derivation_params on j_calls with instance obj, returning a pointer);
1023 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1027 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1028 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1029 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1030 if (commitment_tx->inner != NULL)
1031 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1032 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1033 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1034 long commitment_tx_ref = (long)commitment_tx_var.inner;
1035 if (commitment_tx_var.is_owned) {
1036 commitment_tx_ref |= 1;
1038 //TODO: jobject obj = get object we can call against on j_calls->o
1039 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret; // TODO: Call sign_counterparty_commitment on j_calls with instance obj, returning a pointer, commitment_tx_ref);
1040 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1044 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1045 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1046 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1047 if (commitment_tx->inner != NULL)
1048 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1049 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1050 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1051 long commitment_tx_ref = (long)commitment_tx_var.inner;
1052 if (commitment_tx_var.is_owned) {
1053 commitment_tx_ref |= 1;
1055 //TODO: jobject obj = get object we can call against on j_calls->o
1056 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_holder_commitment on j_calls with instance obj, returning a pointer, commitment_tx_ref);
1057 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1061 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1062 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1063 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1064 if (commitment_tx->inner != NULL)
1065 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1066 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 long commitment_tx_ref = (long)commitment_tx_var.inner;
1069 if (commitment_tx_var.is_owned) {
1070 commitment_tx_ref |= 1;
1072 //TODO: jobject obj = get object we can call against on j_calls->o
1073 LDKCResult_CVec_SignatureZNoneZ* ret; // TODO: Call sign_holder_commitment_htlc_transactions on j_calls with instance obj, returning a pointer, commitment_tx_ref);
1074 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1078 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1079 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1080 LDKTransaction justice_tx_var = justice_tx;
1081 int8_tArray justice_tx_arr = { .len = MALLOC(justice_tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1082 memcpy(justice_tx_arr.len + 1, justice_tx_var.data, justice_tx_var.datalen);
1083 Transaction_free(justice_tx_var);
1084 int8_tArray per_commitment_key_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1085 memcpy(per_commitment_key_arr.len + 1, *per_commitment_key, 32);
1086 LDKHTLCOutputInCommitment htlc_var = *htlc;
1087 if (htlc->inner != NULL)
1088 htlc_var = HTLCOutputInCommitment_clone(htlc);
1089 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1090 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1091 long htlc_ref = (long)htlc_var.inner;
1092 if (htlc_var.is_owned) {
1095 //TODO: jobject obj = get object we can call against on j_calls->o
1096 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_justice_transaction on j_calls with instance obj, returning a pointer, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1097 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1101 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1102 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1103 LDKTransaction htlc_tx_var = htlc_tx;
1104 int8_tArray htlc_tx_arr = { .len = MALLOC(htlc_tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1105 memcpy(htlc_tx_arr.len + 1, htlc_tx_var.data, htlc_tx_var.datalen);
1106 Transaction_free(htlc_tx_var);
1107 int8_tArray per_commitment_point_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1108 memcpy(per_commitment_point_arr.len + 1, per_commitment_point.compressed_form, 33);
1109 LDKHTLCOutputInCommitment htlc_var = *htlc;
1110 if (htlc->inner != NULL)
1111 htlc_var = HTLCOutputInCommitment_clone(htlc);
1112 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1113 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1114 long htlc_ref = (long)htlc_var.inner;
1115 if (htlc_var.is_owned) {
1118 //TODO: jobject obj = get object we can call against on j_calls->o
1119 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_counterparty_htlc_transaction on j_calls with instance obj, returning a pointer, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1120 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1124 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1125 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1126 LDKTransaction closing_tx_var = closing_tx;
1127 int8_tArray closing_tx_arr = { .len = MALLOC(closing_tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1128 memcpy(closing_tx_arr.len + 1, closing_tx_var.data, closing_tx_var.datalen);
1129 Transaction_free(closing_tx_var);
1130 //TODO: jobject obj = get object we can call against on j_calls->o
1131 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_closing_transaction on j_calls with instance obj, returning a pointer, closing_tx_arr);
1132 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1136 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1137 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1138 LDKUnsignedChannelAnnouncement msg_var = *msg;
1139 if (msg->inner != NULL)
1140 msg_var = UnsignedChannelAnnouncement_clone(msg);
1141 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1142 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1143 long msg_ref = (long)msg_var.inner;
1144 if (msg_var.is_owned) {
1147 //TODO: jobject obj = get object we can call against on j_calls->o
1148 LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_channel_announcement on j_calls with instance obj, returning a pointer, msg_ref);
1149 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1153 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1154 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1155 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1156 if (channel_parameters->inner != NULL)
1157 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1158 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1159 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1160 long channel_parameters_ref = (long)channel_parameters_var.inner;
1161 if (channel_parameters_var.is_owned) {
1162 channel_parameters_ref |= 1;
1164 //TODO: jobject obj = get object we can call against on j_calls->o
1165 return; //TODO: Call ready_channel on j_calls with instance obj, channel_parameters_ref);
1167 LDKCVec_u8Z write_jcall(const void* this_arg) {
1168 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1169 //TODO: jobject obj = get object we can call against on j_calls->o
1170 int8_tArray arg; // TODO: Call write on j_calls with instance obj, returning an object);
1171 LDKCVec_u8Z arg_ref;
1172 arg_ref.datalen = *arg.len;
1173 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1174 memcpy(arg_ref.data, arg.len + 1, arg_ref.datalen);
1177 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1178 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1179 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1180 return (void*) this_arg;
1182 static inline LDKChannelKeys LDKChannelKeys_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1183 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1184 atomic_init(&calls->refcnt, 1);
1185 //TODO: Assign calls->o from o
1187 LDKChannelPublicKeys pubkeys_conv;
1188 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1189 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1190 if (pubkeys_conv.inner != NULL)
1191 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1193 LDKChannelKeys ret = {
1194 .this_arg = (void*) calls,
1195 .get_per_commitment_point = get_per_commitment_point_jcall,
1196 .release_commitment_secret = release_commitment_secret_jcall,
1197 .key_derivation_params = key_derivation_params_jcall,
1198 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1199 .sign_holder_commitment = sign_holder_commitment_jcall,
1200 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1201 .sign_justice_transaction = sign_justice_transaction_jcall,
1202 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1203 .sign_closing_transaction = sign_closing_transaction_jcall,
1204 .sign_channel_announcement = sign_channel_announcement_jcall,
1205 .ready_channel = ready_channel_jcall,
1206 .clone = LDKChannelKeys_JCalls_clone,
1207 .write = write_jcall,
1208 .free = LDKChannelKeys_JCalls_free,
1209 .pubkeys = pubkeys_conv,
1210 .set_pubkeys = NULL,
1214 long LDKChannelKeys_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1215 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1216 *res_ptr = LDKChannelKeys_init(NULL, o, pubkeys);
1217 return (long)res_ptr;
1219 int8_tArray ChannelKeys_1get_1per_1commitment_1point(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
1220 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1221 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1222 memcpy(arg_arr.len + 1, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1226 int8_tArray ChannelKeys_1release_1commitment_1secret(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
1227 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1228 int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1229 memcpy(arg_arr.len + 1, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1233 uint32_t ChannelKeys_1key_1derivation_1params(void* ctx_TODO, uint32_t this_arg) {
1234 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1235 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1236 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1237 return (long)ret_ref;
1240 uint32_t ChannelKeys_1sign_1counterparty_1commitment(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1241 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1242 LDKCommitmentTransaction commitment_tx_conv;
1243 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1244 commitment_tx_conv.is_owned = false;
1245 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1246 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1247 return (long)ret_conv;
1250 uint32_t ChannelKeys_1sign_1holder_1commitment(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1251 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1252 LDKHolderCommitmentTransaction commitment_tx_conv;
1253 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1254 commitment_tx_conv.is_owned = false;
1255 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1256 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1257 return (long)ret_conv;
1260 uint32_t ChannelKeys_1sign_1holder_1commitment_1htlc_1transactions(void* ctx_TODO, uint32_t this_arg, uint32_t commitment_tx) {
1261 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1262 LDKHolderCommitmentTransaction commitment_tx_conv;
1263 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1264 commitment_tx_conv.is_owned = false;
1265 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1266 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &commitment_tx_conv);
1267 return (long)ret_conv;
1270 uint32_t ChannelKeys_1sign_1justice_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray justice_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
1271 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1272 LDKTransaction justice_tx_ref;
1273 justice_tx_ref.datalen = *justice_tx.len;
1274 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1275 memcpy(justice_tx_ref.data, justice_tx.len + 1, justice_tx_ref.datalen);
1276 justice_tx_ref.data_is_owned = true;
1277 unsigned char per_commitment_key_arr[32];
1278 CHECK(*per_commitment_key.len == 32);
1279 memcpy(per_commitment_key_arr, per_commitment_key.len + 1, 32);
1280 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1281 LDKHTLCOutputInCommitment htlc_conv;
1282 htlc_conv.inner = (void*)(htlc & (~1));
1283 htlc_conv.is_owned = false;
1284 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1285 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1286 return (long)ret_conv;
1289 uint32_t ChannelKeys_1sign_1counterparty_1htlc_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray htlc_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
1290 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1291 LDKTransaction htlc_tx_ref;
1292 htlc_tx_ref.datalen = *htlc_tx.len;
1293 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1294 memcpy(htlc_tx_ref.data, htlc_tx.len + 1, htlc_tx_ref.datalen);
1295 htlc_tx_ref.data_is_owned = true;
1296 LDKPublicKey per_commitment_point_ref;
1297 CHECK(*per_commitment_point.len == 33);
1298 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
1299 LDKHTLCOutputInCommitment htlc_conv;
1300 htlc_conv.inner = (void*)(htlc & (~1));
1301 htlc_conv.is_owned = false;
1302 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1303 *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);
1304 return (long)ret_conv;
1307 uint32_t ChannelKeys_1sign_1closing_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray closing_tx) {
1308 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1309 LDKTransaction closing_tx_ref;
1310 closing_tx_ref.datalen = *closing_tx.len;
1311 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1312 memcpy(closing_tx_ref.data, closing_tx.len + 1, closing_tx_ref.datalen);
1313 closing_tx_ref.data_is_owned = true;
1314 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1315 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1316 return (long)ret_conv;
1319 uint32_t ChannelKeys_1sign_1channel_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
1320 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1321 LDKUnsignedChannelAnnouncement msg_conv;
1322 msg_conv.inner = (void*)(msg & (~1));
1323 msg_conv.is_owned = false;
1324 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1325 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1326 return (long)ret_conv;
1329 void ChannelKeys_1ready_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t channel_parameters) {
1330 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1331 LDKChannelTransactionParameters channel_parameters_conv;
1332 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1333 channel_parameters_conv.is_owned = false;
1334 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1337 int8_tArray ChannelKeys_1write(void* ctx_TODO, uint32_t this_arg) {
1338 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1339 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1340 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1341 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
1342 CVec_u8Z_free(arg_var);
1346 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1347 if (this_arg->set_pubkeys != NULL)
1348 this_arg->set_pubkeys(this_arg);
1349 return this_arg->pubkeys;
1351 uint32_t ChannelKeys_1get_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
1352 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1353 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1356 long ret_ref = (long)ret_var.inner;
1357 if (ret_var.is_owned) {
1363 uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
1364 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1365 LDKThirtyTwoBytes a_ref;
1366 CHECK(*a.len == 32);
1367 memcpy(a_ref.data, a.len + 1, 32);
1369 LDKChannelMonitor b_conv;
1370 b_conv.inner = (void*)(b & (~1));
1371 b_conv.is_owned = (b & 1) || (b == 0);
1372 // Warning: we may need a move here but can't clone!
1376 int8_tArray LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
1377 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1378 int8_tArray a_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1379 memcpy(a_arr.len + 1, tuple->a.data, 32);
1382 uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
1383 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1384 LDKChannelMonitor b_var = tuple->b;
1385 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1386 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1387 long b_ref = (long)b_var.inner & ~1;
1390 jboolean LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1391 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1393 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1394 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1395 CHECK(val->result_ok);
1396 long res_ref = (long)&(*val->contents.result);
1399 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1400 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1401 CHECK(!val->result_ok);
1402 LDKDecodeError err_var = (*val->contents.err);
1403 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1404 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1405 long err_ref = (long)err_var.inner & ~1;
1408 jboolean LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1409 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1411 uint32_t LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1412 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1413 CHECK(val->result_ok);
1414 long res_ref = (long)&(*val->contents.result);
1417 uint32_t LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1418 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1419 CHECK(!val->result_ok);
1420 LDKDecodeError err_var = (*val->contents.err);
1421 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1422 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1423 long err_ref = (long)err_var.inner & ~1;
1426 jboolean LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1427 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
1429 uint32_t LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1430 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1431 CHECK(val->result_ok);
1432 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1433 *ret = (*val->contents.result);
1436 uint32_t LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1437 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1438 CHECK(!val->result_ok);
1439 LDKDecodeError err_var = (*val->contents.err);
1440 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1441 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1442 long err_ref = (long)err_var.inner & ~1;
1445 jboolean LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1446 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
1448 uint32_t LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1449 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
1450 CHECK(val->result_ok);
1451 LDKInMemoryChannelKeys res_var = (*val->contents.result);
1452 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1453 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1454 long res_ref = (long)res_var.inner & ~1;
1457 uint32_t LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1458 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
1459 CHECK(!val->result_ok);
1460 LDKDecodeError err_var = (*val->contents.err);
1461 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1462 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1463 long err_ref = (long)err_var.inner & ~1;
1466 jboolean LDKCResult_1TxOutAccessErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1467 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1469 uint32_t LDKCResult_1TxOutAccessErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1470 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1471 CHECK(val->result_ok);
1472 long res_ref = (long)&(*val->contents.result);
1473 return (long)res_ref;
1475 uint32_t LDKCResult_1TxOutAccessErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1476 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1477 CHECK(!val->result_ok);
1478 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
1481 uint32_t LDKAPIError_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
1482 LDKAPIError *obj = (LDKAPIError*)ptr;
1484 case LDKAPIError_APIMisuseError: {
1485 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
1486 int8_tArray err_arr = { .len = MALLOC(err_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1487 memcpy(err_arr.len + 1, err_var.data, err_var.datalen);
1488 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
1490 case LDKAPIError_FeeRateTooHigh: {
1491 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
1492 int8_tArray err_arr = { .len = MALLOC(err_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1493 memcpy(err_arr.len + 1, err_var.data, err_var.datalen);
1494 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
1496 case LDKAPIError_RouteError: {
1497 LDKStr err_str = obj->route_error.err;
1498 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
1499 memcpy(err_buf, err_str.chars, err_str.len);
1500 err_buf[err_str.len] = 0;
1501 jstring err_conv = conv_owned_string(err_str.chars);
1503 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
1505 case LDKAPIError_ChannelUnavailable: {
1506 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
1507 int8_tArray err_arr = { .len = MALLOC(err_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1508 memcpy(err_arr.len + 1, err_var.data, err_var.datalen);
1509 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
1511 case LDKAPIError_MonitorUpdateFailed: {
1512 return 0 /* LDKAPIError - MonitorUpdateFailed */;
1517 jboolean LDKCResult_1NoneAPIErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1518 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
1520 void LDKCResult_1NoneAPIErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1521 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
1522 CHECK(val->result_ok);
1523 return *val->contents.result;
1525 uint32_t LDKCResult_1NoneAPIErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1526 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
1527 CHECK(!val->result_ok);
1528 long err_ref = (long)&(*val->contents.err);
1531 static inline LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const LDKCResult_NoneAPIErrorZ *orig) {
1532 LDKCResult_NoneAPIErrorZ res = { .result_ok = orig->result_ok };
1533 if (orig->result_ok) {
1534 res.contents.result = NULL;
1536 LDKAPIError* contents = MALLOC(sizeof(LDKAPIError), "LDKAPIError result Err clone");
1537 *contents = APIError_clone(orig->contents.err);
1538 res.contents.err = contents;
1542 uint32_t LDKCVec_1ChannelDetailsZ_1new(void* ctx_TODO, uint32_tArray elems) {
1543 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1544 ret->datalen = *elems.len;
1545 if (ret->datalen == 0) {
1548 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1549 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
1550 for (size_t i = 0; i < ret->datalen; i++) {
1551 uint32_t arr_elem = java_elems[i];
1552 LDKChannelDetails arr_elem_conv;
1553 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1554 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1555 if (arr_elem_conv.inner != NULL)
1556 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1557 ret->data[i] = arr_elem_conv;
1562 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1563 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1564 for (size_t i = 0; i < ret.datalen; i++) {
1565 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1569 jboolean LDKCResult_1NonePaymentSendFailureZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
1570 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
1572 void LDKCResult_1NonePaymentSendFailureZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
1573 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
1574 CHECK(val->result_ok);
1575 return *val->contents.result;
1577 uint32_t LDKCResult_1NonePaymentSendFailureZ_1get_1err (void* ctx_TODO, uint32_t arg) {
1578 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
1579 CHECK(!val->result_ok);
1580 LDKPaymentSendFailure err_var = (*val->contents.err);
1581 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1582 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1583 long err_ref = (long)err_var.inner & ~1;
1586 uint32_t LDKNetAddress_1ref_1from_1ptr (void* ctx_TODO, uint32_t ptr) {
1587 LDKNetAddress *obj = (LDKNetAddress*)ptr;
1589 case LDKNetAddress_IPv4: {
1590 int8_tArray addr_arr = { .len = MALLOC(4 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1591 memcpy(addr_arr.len + 1, obj->i_pv4.addr.data, 4);
1592 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1594 case LDKNetAddress_IPv6: {
1595 int8_tArray addr_arr = { .len = MALLOC(16 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1596 memcpy(addr_arr.len + 1, obj->i_pv6.addr.data, 16);
1597 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1599 case LDKNetAddress_OnionV2: {
1600 int8_tArray addr_arr = { .len = MALLOC(10 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1601 memcpy(addr_arr.len + 1, obj->onion_v2.addr.data, 10);
1602 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1604 case LDKNetAddress_OnionV3: {
1605 int8_tArray ed25519_pubkey_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1606 memcpy(ed25519_pubkey_arr.len + 1, obj->onion_v3.ed25519_pubkey.data, 32);
1607 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1612 uint32_t LDKCVec_1NetAddressZ_1new(void* ctx_TODO, uint32_tArray elems) {
1613 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1614 ret->datalen = *elems.len;
1615 if (ret->datalen == 0) {
1618 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1619 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
1620 for (size_t i = 0; i < ret->datalen; i++) {
1621 uint32_t arr_elem = java_elems[i];
1622 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
1623 FREE((void*)arr_elem);
1624 ret->data[i] = arr_elem_conv;
1629 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1630 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1631 for (size_t i = 0; i < ret.datalen; i++) {
1632 ret.data[i] = NetAddress_clone(&orig->data[i]);
1636 uint32_t LDKCVec_1ChannelMonitorZ_1new(void* ctx_TODO, uint32_tArray elems) {
1637 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
1638 ret->datalen = *elems.len;
1639 if (ret->datalen == 0) {
1642 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
1643 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
1644 for (size_t i = 0; i < ret->datalen; i++) {
1645 uint32_t arr_elem = java_elems[i];
1646 LDKChannelMonitor arr_elem_conv;
1647 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1648 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1649 // Warning: we may need a move here but can't clone!
1650 ret->data[i] = arr_elem_conv;
1655 typedef struct LDKWatch_JCalls {
1656 atomic_size_t refcnt;
1657 // TODO: Object pointer o;
1658 // TODO: Some kind of method pointer watch_channel_meth;
1659 // TODO: Some kind of method pointer update_channel_meth;
1660 // TODO: Some kind of method pointer release_pending_monitor_events_meth;
1662 static void LDKWatch_JCalls_free(void* this_arg) {
1663 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1664 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1665 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1669 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
1670 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1671 LDKOutPoint funding_txo_var = funding_txo;
1672 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1673 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1674 long funding_txo_ref = (long)funding_txo_var.inner;
1675 if (funding_txo_var.is_owned) {
1676 funding_txo_ref |= 1;
1678 LDKChannelMonitor monitor_var = monitor;
1679 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1680 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1681 long monitor_ref = (long)monitor_var.inner;
1682 if (monitor_var.is_owned) {
1685 //TODO: jobject obj = get object we can call against on j_calls->o
1686 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call watch_channel on j_calls with instance obj, returning a pointer, funding_txo_ref, monitor_ref);
1687 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
1691 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
1692 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1693 LDKOutPoint funding_txo_var = funding_txo;
1694 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1695 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1696 long funding_txo_ref = (long)funding_txo_var.inner;
1697 if (funding_txo_var.is_owned) {
1698 funding_txo_ref |= 1;
1700 LDKChannelMonitorUpdate update_var = update;
1701 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1702 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1703 long update_ref = (long)update_var.inner;
1704 if (update_var.is_owned) {
1707 //TODO: jobject obj = get object we can call against on j_calls->o
1708 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call update_channel on j_calls with instance obj, returning a pointer, funding_txo_ref, update_ref);
1709 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
1713 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
1714 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1715 //TODO: jobject obj = get object we can call against on j_calls->o
1716 uint32_tArray arg; // TODO: Call release_pending_monitor_events on j_calls with instance obj, returning an object);
1717 LDKCVec_MonitorEventZ arg_constr;
1718 arg_constr.datalen = *arg.len;
1719 if (arg_constr.datalen > 0)
1720 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
1722 arg_constr.data = NULL;
1723 uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
1724 for (size_t o = 0; o < arg_constr.datalen; o++) {
1725 uint32_t arr_conv_14 = arg_vals[o];
1726 LDKMonitorEvent arr_conv_14_conv;
1727 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
1728 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
1729 if (arr_conv_14_conv.inner != NULL)
1730 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
1731 arg_constr.data[o] = arr_conv_14_conv;
1735 static void* LDKWatch_JCalls_clone(const void* this_arg) {
1736 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1737 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1738 return (void*) this_arg;
1740 static inline LDKWatch LDKWatch_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1741 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
1742 atomic_init(&calls->refcnt, 1);
1743 //TODO: Assign calls->o from o
1746 .this_arg = (void*) calls,
1747 .watch_channel = watch_channel_jcall,
1748 .update_channel = update_channel_jcall,
1749 .release_pending_monitor_events = release_pending_monitor_events_jcall,
1750 .free = LDKWatch_JCalls_free,
1754 long LDKWatch_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1755 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
1756 *res_ptr = LDKWatch_init(NULL, o);
1757 return (long)res_ptr;
1759 uint32_t Watch_1watch_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
1760 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1761 LDKOutPoint funding_txo_conv;
1762 funding_txo_conv.inner = (void*)(funding_txo & (~1));
1763 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
1764 if (funding_txo_conv.inner != NULL)
1765 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
1766 LDKChannelMonitor monitor_conv;
1767 monitor_conv.inner = (void*)(monitor & (~1));
1768 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
1769 // Warning: we may need a move here but can't clone!
1770 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1771 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
1772 return (long)ret_conv;
1775 uint32_t Watch_1update_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
1776 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1777 LDKOutPoint funding_txo_conv;
1778 funding_txo_conv.inner = (void*)(funding_txo & (~1));
1779 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
1780 if (funding_txo_conv.inner != NULL)
1781 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
1782 LDKChannelMonitorUpdate update_conv;
1783 update_conv.inner = (void*)(update & (~1));
1784 update_conv.is_owned = (update & 1) || (update == 0);
1785 if (update_conv.inner != NULL)
1786 update_conv = ChannelMonitorUpdate_clone(&update_conv);
1787 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1788 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
1789 return (long)ret_conv;
1792 uint32_tArray Watch_1release_1pending_1monitor_1events(void* ctx_TODO, uint32_t this_arg) {
1793 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
1794 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
1795 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
1796 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
1797 for (size_t o = 0; o < ret_var.datalen; o++) {
1798 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
1799 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1800 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1801 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
1802 if (arr_conv_14_var.is_owned) {
1803 arr_conv_14_ref |= 1;
1805 ret_arr_ptr[o] = arr_conv_14_ref;
1811 typedef struct LDKBroadcasterInterface_JCalls {
1812 atomic_size_t refcnt;
1813 // TODO: Object pointer o;
1814 // TODO: Some kind of method pointer broadcast_transaction_meth;
1815 } LDKBroadcasterInterface_JCalls;
1816 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
1817 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1818 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1819 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1823 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
1824 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1825 LDKTransaction tx_var = tx;
1826 int8_tArray tx_arr = { .len = MALLOC(tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1827 memcpy(tx_arr.len + 1, tx_var.data, tx_var.datalen);
1828 Transaction_free(tx_var);
1829 //TODO: jobject obj = get object we can call against on j_calls->o
1830 return; //TODO: Call broadcast_transaction on j_calls with instance obj, tx_arr);
1832 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
1833 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1834 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1835 return (void*) this_arg;
1837 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1838 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
1839 atomic_init(&calls->refcnt, 1);
1840 //TODO: Assign calls->o from o
1842 LDKBroadcasterInterface ret = {
1843 .this_arg = (void*) calls,
1844 .broadcast_transaction = broadcast_transaction_jcall,
1845 .free = LDKBroadcasterInterface_JCalls_free,
1849 long LDKBroadcasterInterface_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1850 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
1851 *res_ptr = LDKBroadcasterInterface_init(NULL, o);
1852 return (long)res_ptr;
1854 void BroadcasterInterface_1broadcast_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray tx) {
1855 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
1856 LDKTransaction tx_ref;
1857 tx_ref.datalen = *tx.len;
1858 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
1859 memcpy(tx_ref.data, tx.len + 1, tx_ref.datalen);
1860 tx_ref.data_is_owned = true;
1861 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
1864 typedef struct LDKKeysInterface_JCalls {
1865 atomic_size_t refcnt;
1866 // TODO: Object pointer o;
1867 // TODO: Some kind of method pointer get_node_secret_meth;
1868 // TODO: Some kind of method pointer get_destination_script_meth;
1869 // TODO: Some kind of method pointer get_shutdown_pubkey_meth;
1870 // TODO: Some kind of method pointer get_channel_keys_meth;
1871 // TODO: Some kind of method pointer get_secure_random_bytes_meth;
1872 // TODO: Some kind of method pointer read_chan_signer_meth;
1873 } LDKKeysInterface_JCalls;
1874 static void LDKKeysInterface_JCalls_free(void* this_arg) {
1875 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1876 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1877 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
1881 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
1882 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1883 //TODO: jobject obj = get object we can call against on j_calls->o
1884 int8_tArray arg; // TODO: Call get_node_secret on j_calls with instance obj, returning an object);
1885 LDKSecretKey arg_ref;
1886 CHECK(*arg.len == 32);
1887 memcpy(arg_ref.bytes, arg.len + 1, 32);
1890 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
1891 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1892 //TODO: jobject obj = get object we can call against on j_calls->o
1893 int8_tArray arg; // TODO: Call get_destination_script on j_calls with instance obj, returning an object);
1894 LDKCVec_u8Z arg_ref;
1895 arg_ref.datalen = *arg.len;
1896 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1897 memcpy(arg_ref.data, arg.len + 1, arg_ref.datalen);
1900 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
1901 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1902 //TODO: jobject obj = get object we can call against on j_calls->o
1903 int8_tArray arg; // TODO: Call get_shutdown_pubkey on j_calls with instance obj, returning an object);
1904 LDKPublicKey arg_ref;
1905 CHECK(*arg.len == 33);
1906 memcpy(arg_ref.compressed_form, arg.len + 1, 33);
1909 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
1910 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1911 //TODO: jobject obj = get object we can call against on j_calls->o
1912 LDKChannelKeys* ret; // TODO: Call get_channel_keys on j_calls with instance obj, returning a pointer, inbound, channel_value_satoshis);
1913 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
1914 ret_conv = ChannelKeys_clone(ret);
1917 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
1918 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1919 //TODO: jobject obj = get object we can call against on j_calls->o
1920 int8_tArray arg; // TODO: Call get_secure_random_bytes on j_calls with instance obj, returning an object);
1921 LDKThirtyTwoBytes arg_ref;
1922 CHECK(*arg.len == 32);
1923 memcpy(arg_ref.data, arg.len + 1, 32);
1926 LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
1927 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1928 LDKu8slice reader_var = reader;
1929 int8_tArray reader_arr = { .len = MALLOC(reader_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1930 memcpy(reader_arr.len + 1, reader_var.data, reader_var.datalen);
1931 //TODO: jobject obj = get object we can call against on j_calls->o
1932 LDKCResult_ChanKeySignerDecodeErrorZ* ret; // TODO: Call read_chan_signer on j_calls with instance obj, returning a pointer, reader_arr);
1933 LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)ret;
1937 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
1938 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1939 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1940 return (void*) this_arg;
1942 static inline LDKKeysInterface LDKKeysInterface_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1943 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
1944 atomic_init(&calls->refcnt, 1);
1945 //TODO: Assign calls->o from o
1947 LDKKeysInterface ret = {
1948 .this_arg = (void*) calls,
1949 .get_node_secret = get_node_secret_jcall,
1950 .get_destination_script = get_destination_script_jcall,
1951 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
1952 .get_channel_keys = get_channel_keys_jcall,
1953 .get_secure_random_bytes = get_secure_random_bytes_jcall,
1954 .read_chan_signer = read_chan_signer_jcall,
1955 .free = LDKKeysInterface_JCalls_free,
1959 long LDKKeysInterface_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
1960 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
1961 *res_ptr = LDKKeysInterface_init(NULL, o);
1962 return (long)res_ptr;
1964 int8_tArray KeysInterface_1get_1node_1secret(void* ctx_TODO, uint32_t this_arg) {
1965 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1966 int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1967 memcpy(arg_arr.len + 1, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
1971 int8_tArray KeysInterface_1get_1destination_1script(void* ctx_TODO, uint32_t this_arg) {
1972 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1973 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
1974 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
1975 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
1976 CVec_u8Z_free(arg_var);
1980 int8_tArray KeysInterface_1get_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_arg) {
1981 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1982 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1983 memcpy(arg_arr.len + 1, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
1987 uint32_t KeysInterface_1get_1channel_1keys(void* ctx_TODO, uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
1988 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1989 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1990 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
1994 int8_tArray KeysInterface_1get_1secure_1random_1bytes(void* ctx_TODO, uint32_t this_arg) {
1995 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
1996 int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
1997 memcpy(arg_arr.len + 1, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2001 uint32_t KeysInterface_1read_1chan_1signer(void* ctx_TODO, uint32_t this_arg, int8_tArray reader) {
2002 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2003 LDKu8slice reader_ref;
2004 reader_ref.datalen = *reader.len;
2005 reader_ref.data = (int8_t*)(reader.len + 1);
2006 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
2007 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2008 return (long)ret_conv;
2011 typedef struct LDKFeeEstimator_JCalls {
2012 atomic_size_t refcnt;
2013 // TODO: Object pointer o;
2014 // TODO: Some kind of method pointer get_est_sat_per_1000_weight_meth;
2015 } LDKFeeEstimator_JCalls;
2016 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2017 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2018 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2019 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
2023 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2024 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2025 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2026 //TODO: jobject obj = get object we can call against on j_calls->o
2027 return 0; //TODO: Call get_est_sat_per_1000_weight on j_calls with instance obj, returning number, confirmation_target_conv);
2029 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2030 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2031 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2032 return (void*) this_arg;
2034 static inline LDKFeeEstimator LDKFeeEstimator_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2035 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2036 atomic_init(&calls->refcnt, 1);
2037 //TODO: Assign calls->o from o
2039 LDKFeeEstimator ret = {
2040 .this_arg = (void*) calls,
2041 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2042 .free = LDKFeeEstimator_JCalls_free,
2046 long LDKFeeEstimator_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2047 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2048 *res_ptr = LDKFeeEstimator_init(NULL, o);
2049 return (long)res_ptr;
2051 int32_t FeeEstimator_1get_1est_1sat_1per_11000_1weight(void* ctx_TODO, uint32_t this_arg, uint32_t confirmation_target) {
2052 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2053 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2054 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2058 typedef struct LDKLogger_JCalls {
2059 atomic_size_t refcnt;
2060 // TODO: Object pointer o;
2061 // TODO: Some kind of method pointer log_meth;
2063 static void LDKLogger_JCalls_free(void* this_arg) {
2064 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2065 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2066 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
2070 void log_jcall(const void* this_arg, const char* record) {
2071 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2072 jstring record_conv = conv_owned_string(record);
2073 //TODO: jobject obj = get object we can call against on j_calls->o
2074 return; //TODO: Call log on j_calls with instance obj, record_conv);
2076 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2077 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2078 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2079 return (void*) this_arg;
2081 static inline LDKLogger LDKLogger_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2082 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2083 atomic_init(&calls->refcnt, 1);
2084 //TODO: Assign calls->o from o
2087 .this_arg = (void*) calls,
2089 .free = LDKLogger_JCalls_free,
2093 long LDKLogger_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
2094 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2095 *res_ptr = LDKLogger_init(NULL, o);
2096 return (long)res_ptr;
2098 uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
2099 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2100 LDKThirtyTwoBytes a_ref;
2101 CHECK(*a.len == 32);
2102 memcpy(a_ref.data, a.len + 1, 32);
2104 LDKChannelManager b_conv;
2105 b_conv.inner = (void*)(b & (~1));
2106 b_conv.is_owned = (b & 1) || (b == 0);
2107 // Warning: we may need a move here but can't clone!
2111 int8_tArray LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
2112 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2113 int8_tArray a_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
2114 memcpy(a_arr.len + 1, tuple->a.data, 32);
2117 uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
2118 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2119 LDKChannelManager b_var = tuple->b;
2120 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2121 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2122 long b_ref = (long)b_var.inner & ~1;
2125 jboolean LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2126 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2128 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2129 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2130 CHECK(val->result_ok);
2131 long res_ref = (long)&(*val->contents.result);
2134 uint32_t LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2135 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2136 CHECK(!val->result_ok);
2137 LDKDecodeError err_var = (*val->contents.err);
2138 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2139 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2140 long err_ref = (long)err_var.inner & ~1;
2143 jboolean LDKCResult_1NetAddressu8Z_1result_1ok (void* ctx_TODO, uint32_t arg) {
2144 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2146 uint32_t LDKCResult_1NetAddressu8Z_1get_1ok (void* ctx_TODO, uint32_t arg) {
2147 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2148 CHECK(val->result_ok);
2149 long res_ref = (long)&(*val->contents.result);
2152 int8_t LDKCResult_1NetAddressu8Z_1get_1err (void* ctx_TODO, uint32_t arg) {
2153 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2154 CHECK(!val->result_ok);
2155 return *val->contents.err;
2157 static inline LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const LDKCResult_NetAddressu8Z *orig) {
2158 LDKCResult_NetAddressu8Z res = { .result_ok = orig->result_ok };
2159 if (orig->result_ok) {
2160 LDKNetAddress* contents = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress result OK clone");
2161 *contents = NetAddress_clone(orig->contents.result);
2162 res.contents.result = contents;
2164 int8_t* contents = MALLOC(sizeof(int8_t), "int8_t result Err clone");
2165 *contents = *orig->contents.err;
2166 res.contents.err = contents;
2170 jboolean LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2171 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2173 uint32_t LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2174 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2175 CHECK(val->result_ok);
2176 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2177 *res_conv = (*val->contents.result);
2178 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2179 return (long)res_conv;
2181 uint32_t LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2182 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2183 CHECK(!val->result_ok);
2184 LDKDecodeError err_var = (*val->contents.err);
2185 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2186 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2187 long err_ref = (long)err_var.inner & ~1;
2190 uint32_t LDKCVec_1u64Z_1new(void* ctx_TODO, int64_tArray elems) {
2191 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2192 ret->datalen = *elems.len;
2193 if (ret->datalen == 0) {
2196 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2197 int64_t *java_elems = (int64_t*)(elems.len + 1);
2198 for (size_t i = 0; i < ret->datalen; i++) {
2199 ret->data[i] = java_elems[i];
2204 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2205 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2206 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2209 uint32_t LDKCVec_1UpdateAddHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2210 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2211 ret->datalen = *elems.len;
2212 if (ret->datalen == 0) {
2215 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2216 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2217 for (size_t i = 0; i < ret->datalen; i++) {
2218 uint32_t arr_elem = java_elems[i];
2219 LDKUpdateAddHTLC arr_elem_conv;
2220 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2221 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2222 if (arr_elem_conv.inner != NULL)
2223 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2224 ret->data[i] = arr_elem_conv;
2229 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2230 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2231 for (size_t i = 0; i < ret.datalen; i++) {
2232 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2236 uint32_t LDKCVec_1UpdateFulfillHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2237 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2238 ret->datalen = *elems.len;
2239 if (ret->datalen == 0) {
2242 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2243 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2244 for (size_t i = 0; i < ret->datalen; i++) {
2245 uint32_t arr_elem = java_elems[i];
2246 LDKUpdateFulfillHTLC arr_elem_conv;
2247 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2248 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2249 if (arr_elem_conv.inner != NULL)
2250 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2251 ret->data[i] = arr_elem_conv;
2256 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2257 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2258 for (size_t i = 0; i < ret.datalen; i++) {
2259 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2263 uint32_t LDKCVec_1UpdateFailHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2264 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2265 ret->datalen = *elems.len;
2266 if (ret->datalen == 0) {
2269 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2270 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2271 for (size_t i = 0; i < ret->datalen; i++) {
2272 uint32_t arr_elem = java_elems[i];
2273 LDKUpdateFailHTLC arr_elem_conv;
2274 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2275 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2276 if (arr_elem_conv.inner != NULL)
2277 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2278 ret->data[i] = arr_elem_conv;
2283 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
2284 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
2285 for (size_t i = 0; i < ret.datalen; i++) {
2286 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
2290 uint32_t LDKCVec_1UpdateFailMalformedHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
2291 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
2292 ret->datalen = *elems.len;
2293 if (ret->datalen == 0) {
2296 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
2297 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2298 for (size_t i = 0; i < ret->datalen; i++) {
2299 uint32_t arr_elem = java_elems[i];
2300 LDKUpdateFailMalformedHTLC arr_elem_conv;
2301 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2302 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2303 if (arr_elem_conv.inner != NULL)
2304 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
2305 ret->data[i] = arr_elem_conv;
2310 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
2311 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
2312 for (size_t i = 0; i < ret.datalen; i++) {
2313 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
2317 jboolean LDKCResult_1boolLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2318 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
2320 jboolean LDKCResult_1boolLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2321 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
2322 CHECK(val->result_ok);
2323 return *val->contents.result;
2325 uint32_t LDKCResult_1boolLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2326 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
2327 CHECK(!val->result_ok);
2328 LDKLightningError err_var = (*val->contents.err);
2329 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2330 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2331 long err_ref = (long)err_var.inner & ~1;
2334 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(void* ctx_TODO, uint32_t a, uint32_t b, uint32_t c) {
2335 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
2336 LDKChannelAnnouncement a_conv;
2337 a_conv.inner = (void*)(a & (~1));
2338 a_conv.is_owned = (a & 1) || (a == 0);
2339 if (a_conv.inner != NULL)
2340 a_conv = ChannelAnnouncement_clone(&a_conv);
2342 LDKChannelUpdate b_conv;
2343 b_conv.inner = (void*)(b & (~1));
2344 b_conv.is_owned = (b & 1) || (b == 0);
2345 if (b_conv.inner != NULL)
2346 b_conv = ChannelUpdate_clone(&b_conv);
2348 LDKChannelUpdate c_conv;
2349 c_conv.inner = (void*)(c & (~1));
2350 c_conv.is_owned = (c & 1) || (c == 0);
2351 if (c_conv.inner != NULL)
2352 c_conv = ChannelUpdate_clone(&c_conv);
2356 static inline LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *orig) {
2357 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret = {
2358 .a = ChannelAnnouncement_clone(&orig->a),
2359 .b = ChannelUpdate_clone(&orig->b),
2360 .c = ChannelUpdate_clone(&orig->c),
2364 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
2365 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
2366 LDKChannelAnnouncement a_var = tuple->a;
2367 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2368 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2369 long a_ref = (long)a_var.inner & ~1;
2372 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
2373 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
2374 LDKChannelUpdate b_var = tuple->b;
2375 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2376 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2377 long b_ref = (long)b_var.inner & ~1;
2380 uint32_t LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(void* ctx_TODO, uint32_t ptr) {
2381 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
2382 LDKChannelUpdate c_var = tuple->c;
2383 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2384 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2385 long c_ref = (long)c_var.inner & ~1;
2388 uint32_t LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(void* ctx_TODO, uint32_tArray elems) {
2389 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
2390 ret->datalen = *elems.len;
2391 if (ret->datalen == 0) {
2394 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
2395 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2396 for (size_t i = 0; i < ret->datalen; i++) {
2397 uint32_t arr_elem = java_elems[i];
2398 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_elem;
2399 FREE((void*)arr_elem);
2400 ret->data[i] = arr_elem_conv;
2405 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
2406 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
2407 for (size_t i = 0; i < ret.datalen; i++) {
2408 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
2412 uint32_t LDKCVec_1NodeAnnouncementZ_1new(void* ctx_TODO, uint32_tArray elems) {
2413 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
2414 ret->datalen = *elems.len;
2415 if (ret->datalen == 0) {
2418 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
2419 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2420 for (size_t i = 0; i < ret->datalen; i++) {
2421 uint32_t arr_elem = java_elems[i];
2422 LDKNodeAnnouncement arr_elem_conv;
2423 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2424 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2425 if (arr_elem_conv.inner != NULL)
2426 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
2427 ret->data[i] = arr_elem_conv;
2432 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2433 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2434 for (size_t i = 0; i < ret.datalen; i++) {
2435 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2439 jboolean LDKCResult_1NoneLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2440 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
2442 void LDKCResult_1NoneLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2443 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
2444 CHECK(val->result_ok);
2445 return *val->contents.result;
2447 uint32_t LDKCResult_1NoneLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2448 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
2449 CHECK(!val->result_ok);
2450 LDKLightningError err_var = (*val->contents.err);
2451 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2452 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2453 long err_ref = (long)err_var.inner & ~1;
2456 jboolean LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2457 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
2459 uint32_t LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2460 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
2461 CHECK(val->result_ok);
2462 LDKChannelReestablish res_var = (*val->contents.result);
2463 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2464 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2465 long res_ref = (long)res_var.inner & ~1;
2468 uint32_t LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2469 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
2470 CHECK(!val->result_ok);
2471 LDKDecodeError err_var = (*val->contents.err);
2472 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2473 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2474 long err_ref = (long)err_var.inner & ~1;
2477 jboolean LDKCResult_1InitDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2478 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
2480 uint32_t LDKCResult_1InitDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2481 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
2482 CHECK(val->result_ok);
2483 LDKInit res_var = (*val->contents.result);
2484 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2485 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2486 long res_ref = (long)res_var.inner & ~1;
2489 uint32_t LDKCResult_1InitDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2490 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
2491 CHECK(!val->result_ok);
2492 LDKDecodeError err_var = (*val->contents.err);
2493 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2494 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2495 long err_ref = (long)err_var.inner & ~1;
2498 jboolean LDKCResult_1PingDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2499 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
2501 uint32_t LDKCResult_1PingDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2502 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
2503 CHECK(val->result_ok);
2504 LDKPing res_var = (*val->contents.result);
2505 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2506 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2507 long res_ref = (long)res_var.inner & ~1;
2510 uint32_t LDKCResult_1PingDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2511 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
2512 CHECK(!val->result_ok);
2513 LDKDecodeError err_var = (*val->contents.err);
2514 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2515 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2516 long err_ref = (long)err_var.inner & ~1;
2519 jboolean LDKCResult_1PongDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2520 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
2522 uint32_t LDKCResult_1PongDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2523 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
2524 CHECK(val->result_ok);
2525 LDKPong res_var = (*val->contents.result);
2526 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2527 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2528 long res_ref = (long)res_var.inner & ~1;
2531 uint32_t LDKCResult_1PongDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2532 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
2533 CHECK(!val->result_ok);
2534 LDKDecodeError err_var = (*val->contents.err);
2535 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2536 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2537 long err_ref = (long)err_var.inner & ~1;
2540 jboolean LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2541 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
2543 uint32_t LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2544 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
2545 CHECK(val->result_ok);
2546 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
2547 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2548 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2549 long res_ref = (long)res_var.inner & ~1;
2552 uint32_t LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2553 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
2554 CHECK(!val->result_ok);
2555 LDKDecodeError err_var = (*val->contents.err);
2556 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2557 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2558 long err_ref = (long)err_var.inner & ~1;
2561 jboolean LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2562 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
2564 uint32_t LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2565 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
2566 CHECK(val->result_ok);
2567 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
2568 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2569 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2570 long res_ref = (long)res_var.inner & ~1;
2573 uint32_t LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2574 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
2575 CHECK(!val->result_ok);
2576 LDKDecodeError err_var = (*val->contents.err);
2577 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2578 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2579 long err_ref = (long)err_var.inner & ~1;
2582 jboolean LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2583 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
2585 uint32_t LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2586 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
2587 CHECK(val->result_ok);
2588 LDKErrorMessage res_var = (*val->contents.result);
2589 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2590 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2591 long res_ref = (long)res_var.inner & ~1;
2594 uint32_t LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2595 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
2596 CHECK(!val->result_ok);
2597 LDKDecodeError err_var = (*val->contents.err);
2598 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2599 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2600 long err_ref = (long)err_var.inner & ~1;
2603 jboolean LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2604 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
2606 uint32_t LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2607 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
2608 CHECK(val->result_ok);
2609 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
2610 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2611 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2612 long res_ref = (long)res_var.inner & ~1;
2615 uint32_t LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2616 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
2617 CHECK(!val->result_ok);
2618 LDKDecodeError err_var = (*val->contents.err);
2619 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2620 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2621 long err_ref = (long)err_var.inner & ~1;
2624 jboolean LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2625 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
2627 uint32_t LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2628 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
2629 CHECK(val->result_ok);
2630 LDKQueryShortChannelIds res_var = (*val->contents.result);
2631 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2632 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2633 long res_ref = (long)res_var.inner & ~1;
2636 uint32_t LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2637 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
2638 CHECK(!val->result_ok);
2639 LDKDecodeError err_var = (*val->contents.err);
2640 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2641 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2642 long err_ref = (long)err_var.inner & ~1;
2645 jboolean LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2646 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
2648 uint32_t LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2649 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
2650 CHECK(val->result_ok);
2651 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
2652 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2653 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2654 long res_ref = (long)res_var.inner & ~1;
2657 uint32_t LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2658 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
2659 CHECK(!val->result_ok);
2660 LDKDecodeError err_var = (*val->contents.err);
2661 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2662 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2663 long err_ref = (long)err_var.inner & ~1;
2666 jboolean LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2667 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
2669 uint32_t LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2670 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
2671 CHECK(val->result_ok);
2672 LDKQueryChannelRange res_var = (*val->contents.result);
2673 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2674 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2675 long res_ref = (long)res_var.inner & ~1;
2678 uint32_t LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2679 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
2680 CHECK(!val->result_ok);
2681 LDKDecodeError err_var = (*val->contents.err);
2682 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2683 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2684 long err_ref = (long)err_var.inner & ~1;
2687 jboolean LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2688 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
2690 uint32_t LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2691 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
2692 CHECK(val->result_ok);
2693 LDKReplyChannelRange res_var = (*val->contents.result);
2694 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2695 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2696 long res_ref = (long)res_var.inner & ~1;
2699 uint32_t LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2700 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
2701 CHECK(!val->result_ok);
2702 LDKDecodeError err_var = (*val->contents.err);
2703 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2704 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2705 long err_ref = (long)err_var.inner & ~1;
2708 jboolean LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2709 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
2711 uint32_t LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2712 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
2713 CHECK(val->result_ok);
2714 LDKGossipTimestampFilter res_var = (*val->contents.result);
2715 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2716 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2717 long res_ref = (long)res_var.inner & ~1;
2720 uint32_t LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2721 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
2722 CHECK(!val->result_ok);
2723 LDKDecodeError err_var = (*val->contents.err);
2724 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2725 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2726 long err_ref = (long)err_var.inner & ~1;
2729 jboolean LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2730 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
2732 int8_tArray LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2733 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
2734 CHECK(val->result_ok);
2735 LDKCVec_u8Z res_var = (*val->contents.result);
2736 int8_tArray res_arr = { .len = MALLOC(res_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
2737 memcpy(res_arr.len + 1, res_var.data, res_var.datalen);
2740 uint32_t LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2741 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
2742 CHECK(!val->result_ok);
2743 LDKPeerHandleError err_var = (*val->contents.err);
2744 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2745 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2746 long err_ref = (long)err_var.inner & ~1;
2749 jboolean LDKCResult_1NonePeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2750 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
2752 void LDKCResult_1NonePeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2753 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
2754 CHECK(val->result_ok);
2755 return *val->contents.result;
2757 uint32_t LDKCResult_1NonePeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2758 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
2759 CHECK(!val->result_ok);
2760 LDKPeerHandleError err_var = (*val->contents.err);
2761 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2762 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2763 long err_ref = (long)err_var.inner & ~1;
2766 jboolean LDKCResult_1boolPeerHandleErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2767 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
2769 jboolean LDKCResult_1boolPeerHandleErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2770 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
2771 CHECK(val->result_ok);
2772 return *val->contents.result;
2774 uint32_t LDKCResult_1boolPeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2775 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
2776 CHECK(!val->result_ok);
2777 LDKPeerHandleError err_var = (*val->contents.err);
2778 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2779 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2780 long err_ref = (long)err_var.inner & ~1;
2783 jboolean LDKCResult_1SecretKeySecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2784 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
2786 int8_tArray LDKCResult_1SecretKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2787 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
2788 CHECK(val->result_ok);
2789 int8_tArray res_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
2790 memcpy(res_arr.len + 1, (*val->contents.result).bytes, 32);
2793 uint32_t LDKCResult_1SecretKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2794 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
2795 CHECK(!val->result_ok);
2796 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2799 jboolean LDKCResult_1PublicKeySecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2800 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
2802 int8_tArray LDKCResult_1PublicKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2803 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
2804 CHECK(val->result_ok);
2805 int8_tArray res_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
2806 memcpy(res_arr.len + 1, (*val->contents.result).compressed_form, 33);
2809 uint32_t LDKCResult_1PublicKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2810 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
2811 CHECK(!val->result_ok);
2812 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2815 jboolean LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2816 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
2818 uint32_t LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2819 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
2820 CHECK(val->result_ok);
2821 LDKTxCreationKeys res_var = (*val->contents.result);
2822 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2823 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2824 long res_ref = (long)res_var.inner & ~1;
2827 uint32_t LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2828 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
2829 CHECK(!val->result_ok);
2830 uint32_t err_conv = LDKSecp256k1Error_to_js((*val->contents.err));
2833 jboolean LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2834 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
2836 uint32_t LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2837 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
2838 CHECK(val->result_ok);
2839 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
2840 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2841 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2842 long res_ref = (long)res_var.inner & ~1;
2845 void LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2846 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
2847 CHECK(!val->result_ok);
2848 return *val->contents.err;
2850 uint32_t LDKCVec_1RouteHopZ_1new(void* ctx_TODO, uint32_tArray elems) {
2851 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
2852 ret->datalen = *elems.len;
2853 if (ret->datalen == 0) {
2856 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
2857 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2858 for (size_t i = 0; i < ret->datalen; i++) {
2859 uint32_t arr_elem = java_elems[i];
2860 LDKRouteHop arr_elem_conv;
2861 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2862 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2863 if (arr_elem_conv.inner != NULL)
2864 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
2865 ret->data[i] = arr_elem_conv;
2870 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2871 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2872 for (size_t i = 0; i < ret.datalen; i++) {
2873 ret.data[i] = RouteHop_clone(&orig->data[i]);
2877 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2878 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2879 for (size_t i = 0; i < ret.datalen; i++) {
2880 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2884 jboolean LDKCResult_1RouteDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2885 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
2887 uint32_t LDKCResult_1RouteDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2888 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
2889 CHECK(val->result_ok);
2890 LDKRoute res_var = (*val->contents.result);
2891 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2892 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2893 long res_ref = (long)res_var.inner & ~1;
2896 uint32_t LDKCResult_1RouteDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2897 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
2898 CHECK(!val->result_ok);
2899 LDKDecodeError err_var = (*val->contents.err);
2900 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2901 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2902 long err_ref = (long)err_var.inner & ~1;
2905 uint32_t LDKCVec_1RouteHintZ_1new(void* ctx_TODO, uint32_tArray elems) {
2906 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
2907 ret->datalen = *elems.len;
2908 if (ret->datalen == 0) {
2911 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
2912 uint32_t *java_elems = (uint32_t*)(elems.len + 1);
2913 for (size_t i = 0; i < ret->datalen; i++) {
2914 uint32_t arr_elem = java_elems[i];
2915 LDKRouteHint arr_elem_conv;
2916 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2917 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2918 if (arr_elem_conv.inner != NULL)
2919 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
2920 ret->data[i] = arr_elem_conv;
2925 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2926 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2927 for (size_t i = 0; i < ret.datalen; i++) {
2928 ret.data[i] = RouteHint_clone(&orig->data[i]);
2932 jboolean LDKCResult_1RouteLightningErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2933 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
2935 uint32_t LDKCResult_1RouteLightningErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2936 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
2937 CHECK(val->result_ok);
2938 LDKRoute res_var = (*val->contents.result);
2939 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2940 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2941 long res_ref = (long)res_var.inner & ~1;
2944 uint32_t LDKCResult_1RouteLightningErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2945 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
2946 CHECK(!val->result_ok);
2947 LDKLightningError err_var = (*val->contents.err);
2948 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2949 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2950 long err_ref = (long)err_var.inner & ~1;
2953 jboolean LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2954 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
2956 uint32_t LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2957 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
2958 CHECK(val->result_ok);
2959 LDKRoutingFees res_var = (*val->contents.result);
2960 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2961 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2962 long res_ref = (long)res_var.inner & ~1;
2965 uint32_t LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2966 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
2967 CHECK(!val->result_ok);
2968 LDKDecodeError err_var = (*val->contents.err);
2969 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2970 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2971 long err_ref = (long)err_var.inner & ~1;
2974 jboolean LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2975 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
2977 uint32_t LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2978 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
2979 CHECK(val->result_ok);
2980 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
2981 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2982 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2983 long res_ref = (long)res_var.inner & ~1;
2986 uint32_t LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
2987 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
2988 CHECK(!val->result_ok);
2989 LDKDecodeError err_var = (*val->contents.err);
2990 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2991 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2992 long err_ref = (long)err_var.inner & ~1;
2995 jboolean LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
2996 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
2998 uint32_t LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
2999 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3000 CHECK(val->result_ok);
3001 LDKNodeInfo res_var = (*val->contents.result);
3002 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3003 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3004 long res_ref = (long)res_var.inner & ~1;
3007 uint32_t LDKCResult_1NodeInfoDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
3008 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3009 CHECK(!val->result_ok);
3010 LDKDecodeError err_var = (*val->contents.err);
3011 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3012 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3013 long err_ref = (long)err_var.inner & ~1;
3016 jboolean LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok (void* ctx_TODO, uint32_t arg) {
3017 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3019 uint32_t LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
3020 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3021 CHECK(val->result_ok);
3022 LDKNetworkGraph res_var = (*val->contents.result);
3023 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3024 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3025 long res_ref = (long)res_var.inner & ~1;
3028 uint32_t LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
3029 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3030 CHECK(!val->result_ok);
3031 LDKDecodeError err_var = (*val->contents.err);
3032 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3033 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3034 long err_ref = (long)err_var.inner & ~1;
3037 typedef struct LDKMessageSendEventsProvider_JCalls {
3038 atomic_size_t refcnt;
3039 // TODO: Object pointer o;
3040 // TODO: Some kind of method pointer get_and_clear_pending_msg_events_meth;
3041 } LDKMessageSendEventsProvider_JCalls;
3042 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3043 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3044 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3045 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3049 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3050 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3051 //TODO: jobject obj = get object we can call against on j_calls->o
3052 uint32_tArray arg; // TODO: Call get_and_clear_pending_msg_events on j_calls with instance obj, returning an object);
3053 LDKCVec_MessageSendEventZ arg_constr;
3054 arg_constr.datalen = *arg.len;
3055 if (arg_constr.datalen > 0)
3056 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3058 arg_constr.data = NULL;
3059 uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
3060 for (size_t s = 0; s < arg_constr.datalen; s++) {
3061 uint32_t arr_conv_18 = arg_vals[s];
3062 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
3063 FREE((void*)arr_conv_18);
3064 arg_constr.data[s] = arr_conv_18_conv;
3068 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3069 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3070 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3071 return (void*) this_arg;
3073 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3074 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3075 atomic_init(&calls->refcnt, 1);
3076 //TODO: Assign calls->o from o
3078 LDKMessageSendEventsProvider ret = {
3079 .this_arg = (void*) calls,
3080 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3081 .free = LDKMessageSendEventsProvider_JCalls_free,
3085 long LDKMessageSendEventsProvider_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3086 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3087 *res_ptr = LDKMessageSendEventsProvider_init(NULL, o);
3088 return (long)res_ptr;
3090 uint32_tArray MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(void* ctx_TODO, uint32_t this_arg) {
3091 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3092 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3093 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
3094 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
3095 for (size_t s = 0; s < ret_var.datalen; s++) {
3096 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3097 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3098 long arr_conv_18_ref = (long)arr_conv_18_copy;
3099 ret_arr_ptr[s] = arr_conv_18_ref;
3105 typedef struct LDKEventsProvider_JCalls {
3106 atomic_size_t refcnt;
3107 // TODO: Object pointer o;
3108 // TODO: Some kind of method pointer get_and_clear_pending_events_meth;
3109 } LDKEventsProvider_JCalls;
3110 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3111 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3112 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3113 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3117 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3118 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3119 //TODO: jobject obj = get object we can call against on j_calls->o
3120 uint32_tArray arg; // TODO: Call get_and_clear_pending_events on j_calls with instance obj, returning an object);
3121 LDKCVec_EventZ arg_constr;
3122 arg_constr.datalen = *arg.len;
3123 if (arg_constr.datalen > 0)
3124 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3126 arg_constr.data = NULL;
3127 uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
3128 for (size_t h = 0; h < arg_constr.datalen; h++) {
3129 uint32_t arr_conv_7 = arg_vals[h];
3130 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
3131 FREE((void*)arr_conv_7);
3132 arg_constr.data[h] = arr_conv_7_conv;
3136 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3137 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3138 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3139 return (void*) this_arg;
3141 static inline LDKEventsProvider LDKEventsProvider_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3142 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3143 atomic_init(&calls->refcnt, 1);
3144 //TODO: Assign calls->o from o
3146 LDKEventsProvider ret = {
3147 .this_arg = (void*) calls,
3148 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3149 .free = LDKEventsProvider_JCalls_free,
3153 long LDKEventsProvider_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3154 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3155 *res_ptr = LDKEventsProvider_init(NULL, o);
3156 return (long)res_ptr;
3158 uint32_tArray EventsProvider_1get_1and_1clear_1pending_1events(void* ctx_TODO, uint32_t this_arg) {
3159 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3160 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3161 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
3162 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
3163 for (size_t h = 0; h < ret_var.datalen; h++) {
3164 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3165 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
3166 long arr_conv_7_ref = (long)arr_conv_7_copy;
3167 ret_arr_ptr[h] = arr_conv_7_ref;
3173 typedef struct LDKAccess_JCalls {
3174 atomic_size_t refcnt;
3175 // TODO: Object pointer o;
3176 // TODO: Some kind of method pointer get_utxo_meth;
3178 static void LDKAccess_JCalls_free(void* this_arg) {
3179 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3180 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3181 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3185 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3186 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3187 int8_tArray genesis_hash_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3188 memcpy(genesis_hash_arr.len + 1, *genesis_hash, 32);
3189 //TODO: jobject obj = get object we can call against on j_calls->o
3190 LDKCResult_TxOutAccessErrorZ* ret; // TODO: Call get_utxo on j_calls with instance obj, returning a pointer, genesis_hash_arr, short_channel_id);
3191 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
3195 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3196 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3197 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3198 return (void*) this_arg;
3200 static inline LDKAccess LDKAccess_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3201 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3202 atomic_init(&calls->refcnt, 1);
3203 //TODO: Assign calls->o from o
3206 .this_arg = (void*) calls,
3207 .get_utxo = get_utxo_jcall,
3208 .free = LDKAccess_JCalls_free,
3212 long LDKAccess_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3213 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3214 *res_ptr = LDKAccess_init(NULL, o);
3215 return (long)res_ptr;
3217 uint32_t Access_1get_1utxo(void* ctx_TODO, uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3218 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3219 unsigned char genesis_hash_arr[32];
3220 CHECK(*genesis_hash.len == 32);
3221 memcpy(genesis_hash_arr, genesis_hash.len + 1, 32);
3222 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3223 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3224 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3225 return (long)ret_conv;
3228 typedef struct LDKFilter_JCalls {
3229 atomic_size_t refcnt;
3230 // TODO: Object pointer o;
3231 // TODO: Some kind of method pointer register_tx_meth;
3232 // TODO: Some kind of method pointer register_output_meth;
3234 static void LDKFilter_JCalls_free(void* this_arg) {
3235 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3236 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3237 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3241 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
3242 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3243 int8_tArray txid_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3244 memcpy(txid_arr.len + 1, *txid, 32);
3245 LDKu8slice script_pubkey_var = script_pubkey;
3246 int8_tArray script_pubkey_arr = { .len = MALLOC(script_pubkey_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
3247 memcpy(script_pubkey_arr.len + 1, script_pubkey_var.data, script_pubkey_var.datalen);
3248 //TODO: jobject obj = get object we can call against on j_calls->o
3249 return; //TODO: Call register_tx on j_calls with instance obj, txid_arr, script_pubkey_arr);
3251 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
3252 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3253 LDKOutPoint outpoint_var = *outpoint;
3254 if (outpoint->inner != NULL)
3255 outpoint_var = OutPoint_clone(outpoint);
3256 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3257 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3258 long outpoint_ref = (long)outpoint_var.inner;
3259 if (outpoint_var.is_owned) {
3262 LDKu8slice script_pubkey_var = script_pubkey;
3263 int8_tArray script_pubkey_arr = { .len = MALLOC(script_pubkey_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
3264 memcpy(script_pubkey_arr.len + 1, script_pubkey_var.data, script_pubkey_var.datalen);
3265 //TODO: jobject obj = get object we can call against on j_calls->o
3266 return; //TODO: Call register_output on j_calls with instance obj, outpoint_ref, script_pubkey_arr);
3268 static void* LDKFilter_JCalls_clone(const void* this_arg) {
3269 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3270 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3271 return (void*) this_arg;
3273 static inline LDKFilter LDKFilter_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3274 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
3275 atomic_init(&calls->refcnt, 1);
3276 //TODO: Assign calls->o from o
3279 .this_arg = (void*) calls,
3280 .register_tx = register_tx_jcall,
3281 .register_output = register_output_jcall,
3282 .free = LDKFilter_JCalls_free,
3286 long LDKFilter_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3287 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
3288 *res_ptr = LDKFilter_init(NULL, o);
3289 return (long)res_ptr;
3291 void Filter_1register_1tx(void* ctx_TODO, uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
3292 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3293 unsigned char txid_arr[32];
3294 CHECK(*txid.len == 32);
3295 memcpy(txid_arr, txid.len + 1, 32);
3296 unsigned char (*txid_ref)[32] = &txid_arr;
3297 LDKu8slice script_pubkey_ref;
3298 script_pubkey_ref.datalen = *script_pubkey.len;
3299 script_pubkey_ref.data = (int8_t*)(script_pubkey.len + 1);
3300 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
3303 void Filter_1register_1output(void* ctx_TODO, uint32_t this_arg, uint32_t outpoint, int8_tArray script_pubkey) {
3304 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3305 LDKOutPoint outpoint_conv;
3306 outpoint_conv.inner = (void*)(outpoint & (~1));
3307 outpoint_conv.is_owned = false;
3308 LDKu8slice script_pubkey_ref;
3309 script_pubkey_ref.datalen = *script_pubkey.len;
3310 script_pubkey_ref.data = (int8_t*)(script_pubkey.len + 1);
3311 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
3314 typedef struct LDKPersist_JCalls {
3315 atomic_size_t refcnt;
3316 // TODO: Object pointer o;
3317 // TODO: Some kind of method pointer persist_new_channel_meth;
3318 // TODO: Some kind of method pointer update_persisted_channel_meth;
3319 } LDKPersist_JCalls;
3320 static void LDKPersist_JCalls_free(void* this_arg) {
3321 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3322 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3323 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3327 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
3328 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3329 LDKOutPoint id_var = id;
3330 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3331 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3332 long id_ref = (long)id_var.inner;
3333 if (id_var.is_owned) {
3336 LDKChannelMonitor data_var = *data;
3337 // Warning: we may need a move here but can't clone!
3338 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3339 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3340 long data_ref = (long)data_var.inner;
3341 if (data_var.is_owned) {
3344 //TODO: jobject obj = get object we can call against on j_calls->o
3345 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call persist_new_channel on j_calls with instance obj, returning a pointer, id_ref, data_ref);
3346 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
3350 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
3351 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3352 LDKOutPoint id_var = id;
3353 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3354 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3355 long id_ref = (long)id_var.inner;
3356 if (id_var.is_owned) {
3359 LDKChannelMonitorUpdate update_var = *update;
3360 if (update->inner != NULL)
3361 update_var = ChannelMonitorUpdate_clone(update);
3362 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3363 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3364 long update_ref = (long)update_var.inner;
3365 if (update_var.is_owned) {
3368 LDKChannelMonitor data_var = *data;
3369 // Warning: we may need a move here but can't clone!
3370 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3371 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3372 long data_ref = (long)data_var.inner;
3373 if (data_var.is_owned) {
3376 //TODO: jobject obj = get object we can call against on j_calls->o
3377 LDKCResult_NoneChannelMonitorUpdateErrZ* ret; // TODO: Call update_persisted_channel on j_calls with instance obj, returning a pointer, id_ref, update_ref, data_ref);
3378 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
3382 static void* LDKPersist_JCalls_clone(const void* this_arg) {
3383 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
3384 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3385 return (void*) this_arg;
3387 static inline LDKPersist LDKPersist_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3388 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
3389 atomic_init(&calls->refcnt, 1);
3390 //TODO: Assign calls->o from o
3393 .this_arg = (void*) calls,
3394 .persist_new_channel = persist_new_channel_jcall,
3395 .update_persisted_channel = update_persisted_channel_jcall,
3396 .free = LDKPersist_JCalls_free,
3400 long LDKPersist_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
3401 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
3402 *res_ptr = LDKPersist_init(NULL, o);
3403 return (long)res_ptr;
3405 uint32_t Persist_1persist_1new_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t id, uint32_t data) {
3406 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
3407 LDKOutPoint id_conv;
3408 id_conv.inner = (void*)(id & (~1));
3409 id_conv.is_owned = (id & 1) || (id == 0);
3410 if (id_conv.inner != NULL)
3411 id_conv = OutPoint_clone(&id_conv);
3412 LDKChannelMonitor data_conv;
3413 data_conv.inner = (void*)(data & (~1));
3414 data_conv.is_owned = false;
3415 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3416 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
3417 return (long)ret_conv;
3420 uint32_t Persist_1update_1persisted_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
3421 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
3422 LDKOutPoint id_conv;
3423 id_conv.inner = (void*)(id & (~1));
3424 id_conv.is_owned = (id & 1) || (id == 0);
3425 if (id_conv.inner != NULL)
3426 id_conv = OutPoint_clone(&id_conv);
3427 LDKChannelMonitorUpdate update_conv;
3428 update_conv.inner = (void*)(update & (~1));
3429 update_conv.is_owned = false;
3430 LDKChannelMonitor data_conv;
3431 data_conv.inner = (void*)(data & (~1));
3432 data_conv.is_owned = false;
3433 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3434 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
3435 return (long)ret_conv;
3438 typedef struct LDKChannelMessageHandler_JCalls {
3439 atomic_size_t refcnt;
3440 // TODO: Object pointer o;
3441 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3442 // TODO: Some kind of method pointer handle_open_channel_meth;
3443 // TODO: Some kind of method pointer handle_accept_channel_meth;
3444 // TODO: Some kind of method pointer handle_funding_created_meth;
3445 // TODO: Some kind of method pointer handle_funding_signed_meth;
3446 // TODO: Some kind of method pointer handle_funding_locked_meth;
3447 // TODO: Some kind of method pointer handle_shutdown_meth;
3448 // TODO: Some kind of method pointer handle_closing_signed_meth;
3449 // TODO: Some kind of method pointer handle_update_add_htlc_meth;
3450 // TODO: Some kind of method pointer handle_update_fulfill_htlc_meth;
3451 // TODO: Some kind of method pointer handle_update_fail_htlc_meth;
3452 // TODO: Some kind of method pointer handle_update_fail_malformed_htlc_meth;
3453 // TODO: Some kind of method pointer handle_commitment_signed_meth;
3454 // TODO: Some kind of method pointer handle_revoke_and_ack_meth;
3455 // TODO: Some kind of method pointer handle_update_fee_meth;
3456 // TODO: Some kind of method pointer handle_announcement_signatures_meth;
3457 // TODO: Some kind of method pointer peer_disconnected_meth;
3458 // TODO: Some kind of method pointer peer_connected_meth;
3459 // TODO: Some kind of method pointer handle_channel_reestablish_meth;
3460 // TODO: Some kind of method pointer handle_error_meth;
3461 } LDKChannelMessageHandler_JCalls;
3462 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3463 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3464 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3465 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
3469 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
3470 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3471 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3472 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3473 LDKInitFeatures their_features_var = their_features;
3474 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3475 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3476 long their_features_ref = (long)their_features_var.inner;
3477 if (their_features_var.is_owned) {
3478 their_features_ref |= 1;
3480 LDKOpenChannel msg_var = *msg;
3481 if (msg->inner != NULL)
3482 msg_var = OpenChannel_clone(msg);
3483 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3484 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3485 long msg_ref = (long)msg_var.inner;
3486 if (msg_var.is_owned) {
3489 //TODO: jobject obj = get object we can call against on j_calls->o
3490 return; //TODO: Call handle_open_channel on j_calls with instance obj, their_node_id_arr, their_features_ref, msg_ref);
3492 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
3493 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3494 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3495 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3496 LDKInitFeatures their_features_var = their_features;
3497 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3498 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3499 long their_features_ref = (long)their_features_var.inner;
3500 if (their_features_var.is_owned) {
3501 their_features_ref |= 1;
3503 LDKAcceptChannel msg_var = *msg;
3504 if (msg->inner != NULL)
3505 msg_var = AcceptChannel_clone(msg);
3506 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3507 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3508 long msg_ref = (long)msg_var.inner;
3509 if (msg_var.is_owned) {
3512 //TODO: jobject obj = get object we can call against on j_calls->o
3513 return; //TODO: Call handle_accept_channel on j_calls with instance obj, their_node_id_arr, their_features_ref, msg_ref);
3515 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
3516 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3517 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3518 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3519 LDKFundingCreated msg_var = *msg;
3520 if (msg->inner != NULL)
3521 msg_var = FundingCreated_clone(msg);
3522 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3523 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3524 long msg_ref = (long)msg_var.inner;
3525 if (msg_var.is_owned) {
3528 //TODO: jobject obj = get object we can call against on j_calls->o
3529 return; //TODO: Call handle_funding_created on j_calls with instance obj, their_node_id_arr, msg_ref);
3531 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
3532 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3533 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3534 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3535 LDKFundingSigned msg_var = *msg;
3536 if (msg->inner != NULL)
3537 msg_var = FundingSigned_clone(msg);
3538 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3539 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3540 long msg_ref = (long)msg_var.inner;
3541 if (msg_var.is_owned) {
3544 //TODO: jobject obj = get object we can call against on j_calls->o
3545 return; //TODO: Call handle_funding_signed on j_calls with instance obj, their_node_id_arr, msg_ref);
3547 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
3548 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3549 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3550 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3551 LDKFundingLocked msg_var = *msg;
3552 if (msg->inner != NULL)
3553 msg_var = FundingLocked_clone(msg);
3554 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3555 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3556 long msg_ref = (long)msg_var.inner;
3557 if (msg_var.is_owned) {
3560 //TODO: jobject obj = get object we can call against on j_calls->o
3561 return; //TODO: Call handle_funding_locked on j_calls with instance obj, their_node_id_arr, msg_ref);
3563 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
3564 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3565 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3566 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3567 LDKShutdown msg_var = *msg;
3568 if (msg->inner != NULL)
3569 msg_var = Shutdown_clone(msg);
3570 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3571 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3572 long msg_ref = (long)msg_var.inner;
3573 if (msg_var.is_owned) {
3576 //TODO: jobject obj = get object we can call against on j_calls->o
3577 return; //TODO: Call handle_shutdown on j_calls with instance obj, their_node_id_arr, msg_ref);
3579 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
3580 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3581 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3582 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3583 LDKClosingSigned msg_var = *msg;
3584 if (msg->inner != NULL)
3585 msg_var = ClosingSigned_clone(msg);
3586 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3587 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3588 long msg_ref = (long)msg_var.inner;
3589 if (msg_var.is_owned) {
3592 //TODO: jobject obj = get object we can call against on j_calls->o
3593 return; //TODO: Call handle_closing_signed on j_calls with instance obj, their_node_id_arr, msg_ref);
3595 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
3596 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3597 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3598 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3599 LDKUpdateAddHTLC msg_var = *msg;
3600 if (msg->inner != NULL)
3601 msg_var = UpdateAddHTLC_clone(msg);
3602 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3603 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3604 long msg_ref = (long)msg_var.inner;
3605 if (msg_var.is_owned) {
3608 //TODO: jobject obj = get object we can call against on j_calls->o
3609 return; //TODO: Call handle_update_add_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3611 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
3612 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3613 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3614 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3615 LDKUpdateFulfillHTLC msg_var = *msg;
3616 if (msg->inner != NULL)
3617 msg_var = UpdateFulfillHTLC_clone(msg);
3618 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3619 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3620 long msg_ref = (long)msg_var.inner;
3621 if (msg_var.is_owned) {
3624 //TODO: jobject obj = get object we can call against on j_calls->o
3625 return; //TODO: Call handle_update_fulfill_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3627 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
3628 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3629 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3630 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3631 LDKUpdateFailHTLC msg_var = *msg;
3632 if (msg->inner != NULL)
3633 msg_var = UpdateFailHTLC_clone(msg);
3634 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3635 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3636 long msg_ref = (long)msg_var.inner;
3637 if (msg_var.is_owned) {
3640 //TODO: jobject obj = get object we can call against on j_calls->o
3641 return; //TODO: Call handle_update_fail_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3643 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
3644 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3645 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3646 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3647 LDKUpdateFailMalformedHTLC msg_var = *msg;
3648 if (msg->inner != NULL)
3649 msg_var = UpdateFailMalformedHTLC_clone(msg);
3650 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3651 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3652 long msg_ref = (long)msg_var.inner;
3653 if (msg_var.is_owned) {
3656 //TODO: jobject obj = get object we can call against on j_calls->o
3657 return; //TODO: Call handle_update_fail_malformed_htlc on j_calls with instance obj, their_node_id_arr, msg_ref);
3659 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
3660 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3661 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3662 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3663 LDKCommitmentSigned msg_var = *msg;
3664 if (msg->inner != NULL)
3665 msg_var = CommitmentSigned_clone(msg);
3666 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3667 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3668 long msg_ref = (long)msg_var.inner;
3669 if (msg_var.is_owned) {
3672 //TODO: jobject obj = get object we can call against on j_calls->o
3673 return; //TODO: Call handle_commitment_signed on j_calls with instance obj, their_node_id_arr, msg_ref);
3675 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
3676 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3677 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3678 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3679 LDKRevokeAndACK msg_var = *msg;
3680 if (msg->inner != NULL)
3681 msg_var = RevokeAndACK_clone(msg);
3682 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3683 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3684 long msg_ref = (long)msg_var.inner;
3685 if (msg_var.is_owned) {
3688 //TODO: jobject obj = get object we can call against on j_calls->o
3689 return; //TODO: Call handle_revoke_and_ack on j_calls with instance obj, their_node_id_arr, msg_ref);
3691 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
3692 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3693 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3694 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3695 LDKUpdateFee msg_var = *msg;
3696 if (msg->inner != NULL)
3697 msg_var = UpdateFee_clone(msg);
3698 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3699 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3700 long msg_ref = (long)msg_var.inner;
3701 if (msg_var.is_owned) {
3704 //TODO: jobject obj = get object we can call against on j_calls->o
3705 return; //TODO: Call handle_update_fee on j_calls with instance obj, their_node_id_arr, msg_ref);
3707 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
3708 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3709 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3710 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3711 LDKAnnouncementSignatures msg_var = *msg;
3712 if (msg->inner != NULL)
3713 msg_var = AnnouncementSignatures_clone(msg);
3714 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3715 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3716 long msg_ref = (long)msg_var.inner;
3717 if (msg_var.is_owned) {
3720 //TODO: jobject obj = get object we can call against on j_calls->o
3721 return; //TODO: Call handle_announcement_signatures on j_calls with instance obj, their_node_id_arr, msg_ref);
3723 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3724 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3725 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3726 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3727 //TODO: jobject obj = get object we can call against on j_calls->o
3728 return; //TODO: Call peer_disconnected on j_calls with instance obj, their_node_id_arr, no_connection_possible);
3730 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
3731 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3732 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3733 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3734 LDKInit msg_var = *msg;
3735 if (msg->inner != NULL)
3736 msg_var = Init_clone(msg);
3737 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3738 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3739 long msg_ref = (long)msg_var.inner;
3740 if (msg_var.is_owned) {
3743 //TODO: jobject obj = get object we can call against on j_calls->o
3744 return; //TODO: Call peer_connected on j_calls with instance obj, their_node_id_arr, msg_ref);
3746 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
3747 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3748 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3749 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3750 LDKChannelReestablish msg_var = *msg;
3751 if (msg->inner != NULL)
3752 msg_var = ChannelReestablish_clone(msg);
3753 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3754 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3755 long msg_ref = (long)msg_var.inner;
3756 if (msg_var.is_owned) {
3759 //TODO: jobject obj = get object we can call against on j_calls->o
3760 return; //TODO: Call handle_channel_reestablish on j_calls with instance obj, their_node_id_arr, msg_ref);
3762 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
3763 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3764 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
3765 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
3766 LDKErrorMessage msg_var = *msg;
3767 if (msg->inner != NULL)
3768 msg_var = ErrorMessage_clone(msg);
3769 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3770 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3771 long msg_ref = (long)msg_var.inner;
3772 if (msg_var.is_owned) {
3775 //TODO: jobject obj = get object we can call against on j_calls->o
3776 return; //TODO: Call handle_error on j_calls with instance obj, their_node_id_arr, msg_ref);
3778 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3779 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3780 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3781 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3782 return (void*) this_arg;
3784 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
3785 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3786 atomic_init(&calls->refcnt, 1);
3787 //TODO: Assign calls->o from o
3789 LDKChannelMessageHandler ret = {
3790 .this_arg = (void*) calls,
3791 .handle_open_channel = handle_open_channel_jcall,
3792 .handle_accept_channel = handle_accept_channel_jcall,
3793 .handle_funding_created = handle_funding_created_jcall,
3794 .handle_funding_signed = handle_funding_signed_jcall,
3795 .handle_funding_locked = handle_funding_locked_jcall,
3796 .handle_shutdown = handle_shutdown_jcall,
3797 .handle_closing_signed = handle_closing_signed_jcall,
3798 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3799 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3800 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3801 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3802 .handle_commitment_signed = handle_commitment_signed_jcall,
3803 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3804 .handle_update_fee = handle_update_fee_jcall,
3805 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3806 .peer_disconnected = peer_disconnected_jcall,
3807 .peer_connected = peer_connected_jcall,
3808 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3809 .handle_error = handle_error_jcall,
3810 .free = LDKChannelMessageHandler_JCalls_free,
3811 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(NULL, MessageSendEventsProvider),
3813 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3816 long LDKChannelMessageHandler_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
3817 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3818 *res_ptr = LDKChannelMessageHandler_init(NULL, o, MessageSendEventsProvider);
3819 return (long)res_ptr;
3821 void ChannelMessageHandler_1handle_1open_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
3822 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3823 LDKPublicKey their_node_id_ref;
3824 CHECK(*their_node_id.len == 33);
3825 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3826 LDKInitFeatures their_features_conv;
3827 their_features_conv.inner = (void*)(their_features & (~1));
3828 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3829 // Warning: we may need a move here but can't clone!
3830 LDKOpenChannel msg_conv;
3831 msg_conv.inner = (void*)(msg & (~1));
3832 msg_conv.is_owned = false;
3833 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3836 void ChannelMessageHandler_1handle_1accept_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
3837 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3838 LDKPublicKey their_node_id_ref;
3839 CHECK(*their_node_id.len == 33);
3840 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3841 LDKInitFeatures their_features_conv;
3842 their_features_conv.inner = (void*)(their_features & (~1));
3843 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3844 // Warning: we may need a move here but can't clone!
3845 LDKAcceptChannel msg_conv;
3846 msg_conv.inner = (void*)(msg & (~1));
3847 msg_conv.is_owned = false;
3848 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3851 void ChannelMessageHandler_1handle_1funding_1created(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3852 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3853 LDKPublicKey their_node_id_ref;
3854 CHECK(*their_node_id.len == 33);
3855 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3856 LDKFundingCreated msg_conv;
3857 msg_conv.inner = (void*)(msg & (~1));
3858 msg_conv.is_owned = false;
3859 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3862 void ChannelMessageHandler_1handle_1funding_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3863 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3864 LDKPublicKey their_node_id_ref;
3865 CHECK(*their_node_id.len == 33);
3866 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3867 LDKFundingSigned msg_conv;
3868 msg_conv.inner = (void*)(msg & (~1));
3869 msg_conv.is_owned = false;
3870 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3873 void ChannelMessageHandler_1handle_1funding_1locked(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3874 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3875 LDKPublicKey their_node_id_ref;
3876 CHECK(*their_node_id.len == 33);
3877 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3878 LDKFundingLocked msg_conv;
3879 msg_conv.inner = (void*)(msg & (~1));
3880 msg_conv.is_owned = false;
3881 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3884 void ChannelMessageHandler_1handle_1shutdown(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3885 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3886 LDKPublicKey their_node_id_ref;
3887 CHECK(*their_node_id.len == 33);
3888 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3889 LDKShutdown msg_conv;
3890 msg_conv.inner = (void*)(msg & (~1));
3891 msg_conv.is_owned = false;
3892 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3895 void ChannelMessageHandler_1handle_1closing_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3896 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3897 LDKPublicKey their_node_id_ref;
3898 CHECK(*their_node_id.len == 33);
3899 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3900 LDKClosingSigned msg_conv;
3901 msg_conv.inner = (void*)(msg & (~1));
3902 msg_conv.is_owned = false;
3903 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3906 void ChannelMessageHandler_1handle_1update_1add_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3907 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3908 LDKPublicKey their_node_id_ref;
3909 CHECK(*their_node_id.len == 33);
3910 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3911 LDKUpdateAddHTLC msg_conv;
3912 msg_conv.inner = (void*)(msg & (~1));
3913 msg_conv.is_owned = false;
3914 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3917 void ChannelMessageHandler_1handle_1update_1fulfill_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3918 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3919 LDKPublicKey their_node_id_ref;
3920 CHECK(*their_node_id.len == 33);
3921 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3922 LDKUpdateFulfillHTLC msg_conv;
3923 msg_conv.inner = (void*)(msg & (~1));
3924 msg_conv.is_owned = false;
3925 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3928 void ChannelMessageHandler_1handle_1update_1fail_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3929 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3930 LDKPublicKey their_node_id_ref;
3931 CHECK(*their_node_id.len == 33);
3932 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3933 LDKUpdateFailHTLC msg_conv;
3934 msg_conv.inner = (void*)(msg & (~1));
3935 msg_conv.is_owned = false;
3936 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3939 void ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3940 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3941 LDKPublicKey their_node_id_ref;
3942 CHECK(*their_node_id.len == 33);
3943 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3944 LDKUpdateFailMalformedHTLC msg_conv;
3945 msg_conv.inner = (void*)(msg & (~1));
3946 msg_conv.is_owned = false;
3947 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3950 void ChannelMessageHandler_1handle_1commitment_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3951 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3952 LDKPublicKey their_node_id_ref;
3953 CHECK(*their_node_id.len == 33);
3954 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3955 LDKCommitmentSigned msg_conv;
3956 msg_conv.inner = (void*)(msg & (~1));
3957 msg_conv.is_owned = false;
3958 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3961 void ChannelMessageHandler_1handle_1revoke_1and_1ack(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3962 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3963 LDKPublicKey their_node_id_ref;
3964 CHECK(*their_node_id.len == 33);
3965 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3966 LDKRevokeAndACK msg_conv;
3967 msg_conv.inner = (void*)(msg & (~1));
3968 msg_conv.is_owned = false;
3969 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3972 void ChannelMessageHandler_1handle_1update_1fee(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3973 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3974 LDKPublicKey their_node_id_ref;
3975 CHECK(*their_node_id.len == 33);
3976 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3977 LDKUpdateFee msg_conv;
3978 msg_conv.inner = (void*)(msg & (~1));
3979 msg_conv.is_owned = false;
3980 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3983 void ChannelMessageHandler_1handle_1announcement_1signatures(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
3984 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3985 LDKPublicKey their_node_id_ref;
3986 CHECK(*their_node_id.len == 33);
3987 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3988 LDKAnnouncementSignatures msg_conv;
3989 msg_conv.inner = (void*)(msg & (~1));
3990 msg_conv.is_owned = false;
3991 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3994 void ChannelMessageHandler_1peer_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
3995 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3996 LDKPublicKey their_node_id_ref;
3997 CHECK(*their_node_id.len == 33);
3998 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
3999 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4002 void ChannelMessageHandler_1peer_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4003 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4004 LDKPublicKey their_node_id_ref;
4005 CHECK(*their_node_id.len == 33);
4006 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4008 msg_conv.inner = (void*)(msg & (~1));
4009 msg_conv.is_owned = false;
4010 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4013 void ChannelMessageHandler_1handle_1channel_1reestablish(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4014 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4015 LDKPublicKey their_node_id_ref;
4016 CHECK(*their_node_id.len == 33);
4017 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4018 LDKChannelReestablish msg_conv;
4019 msg_conv.inner = (void*)(msg & (~1));
4020 msg_conv.is_owned = false;
4021 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4024 void ChannelMessageHandler_1handle_1error(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4025 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4026 LDKPublicKey their_node_id_ref;
4027 CHECK(*their_node_id.len == 33);
4028 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4029 LDKErrorMessage msg_conv;
4030 msg_conv.inner = (void*)(msg & (~1));
4031 msg_conv.is_owned = false;
4032 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4035 typedef struct LDKRoutingMessageHandler_JCalls {
4036 atomic_size_t refcnt;
4037 // TODO: Object pointer o;
4038 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4039 // TODO: Some kind of method pointer handle_node_announcement_meth;
4040 // TODO: Some kind of method pointer handle_channel_announcement_meth;
4041 // TODO: Some kind of method pointer handle_channel_update_meth;
4042 // TODO: Some kind of method pointer handle_htlc_fail_channel_update_meth;
4043 // TODO: Some kind of method pointer get_next_channel_announcements_meth;
4044 // TODO: Some kind of method pointer get_next_node_announcements_meth;
4045 // TODO: Some kind of method pointer sync_routing_table_meth;
4046 // TODO: Some kind of method pointer handle_reply_channel_range_meth;
4047 // TODO: Some kind of method pointer handle_reply_short_channel_ids_end_meth;
4048 // TODO: Some kind of method pointer handle_query_channel_range_meth;
4049 // TODO: Some kind of method pointer handle_query_short_channel_ids_meth;
4050 } LDKRoutingMessageHandler_JCalls;
4051 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4052 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4053 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4054 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
4058 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4059 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4060 LDKNodeAnnouncement msg_var = *msg;
4061 if (msg->inner != NULL)
4062 msg_var = NodeAnnouncement_clone(msg);
4063 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4064 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4065 long msg_ref = (long)msg_var.inner;
4066 if (msg_var.is_owned) {
4069 //TODO: jobject obj = get object we can call against on j_calls->o
4070 LDKCResult_boolLightningErrorZ* ret; // TODO: Call handle_node_announcement on j_calls with instance obj, returning a pointer, msg_ref);
4071 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4075 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4076 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4077 LDKChannelAnnouncement msg_var = *msg;
4078 if (msg->inner != NULL)
4079 msg_var = ChannelAnnouncement_clone(msg);
4080 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4081 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4082 long msg_ref = (long)msg_var.inner;
4083 if (msg_var.is_owned) {
4086 //TODO: jobject obj = get object we can call against on j_calls->o
4087 LDKCResult_boolLightningErrorZ* ret; // TODO: Call handle_channel_announcement on j_calls with instance obj, returning a pointer, msg_ref);
4088 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4092 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4093 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4094 LDKChannelUpdate msg_var = *msg;
4095 if (msg->inner != NULL)
4096 msg_var = ChannelUpdate_clone(msg);
4097 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4098 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4099 long msg_ref = (long)msg_var.inner;
4100 if (msg_var.is_owned) {
4103 //TODO: jobject obj = get object we can call against on j_calls->o
4104 LDKCResult_boolLightningErrorZ* ret; // TODO: Call handle_channel_update on j_calls with instance obj, returning a pointer, msg_ref);
4105 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4109 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4110 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4111 long ret_update = (long)update;
4112 //TODO: jobject obj = get object we can call against on j_calls->o
4113 return; //TODO: Call handle_htlc_fail_channel_update on j_calls with instance obj, ret_update);
4115 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4116 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4117 //TODO: jobject obj = get object we can call against on j_calls->o
4118 uint32_tArray arg; // TODO: Call get_next_channel_announcements on j_calls with instance obj, returning an object, starting_point, batch_amount);
4119 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4120 arg_constr.datalen = *arg.len;
4121 if (arg_constr.datalen > 0)
4122 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4124 arg_constr.data = NULL;
4125 uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
4126 for (size_t l = 0; l < arg_constr.datalen; l++) {
4127 uint32_t arr_conv_63 = arg_vals[l];
4128 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4129 FREE((void*)arr_conv_63);
4130 arg_constr.data[l] = arr_conv_63_conv;
4134 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4135 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4136 int8_tArray starting_point_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
4137 memcpy(starting_point_arr.len + 1, starting_point.compressed_form, 33);
4138 //TODO: jobject obj = get object we can call against on j_calls->o
4139 uint32_tArray arg; // TODO: Call get_next_node_announcements on j_calls with instance obj, returning an object, starting_point_arr, batch_amount);
4140 LDKCVec_NodeAnnouncementZ arg_constr;
4141 arg_constr.datalen = *arg.len;
4142 if (arg_constr.datalen > 0)
4143 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4145 arg_constr.data = NULL;
4146 uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
4147 for (size_t s = 0; s < arg_constr.datalen; s++) {
4148 uint32_t arr_conv_18 = arg_vals[s];
4149 LDKNodeAnnouncement arr_conv_18_conv;
4150 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4151 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4152 if (arr_conv_18_conv.inner != NULL)
4153 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4154 arg_constr.data[s] = arr_conv_18_conv;
4158 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
4159 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4160 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
4161 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
4162 LDKInit init_var = *init;
4163 if (init->inner != NULL)
4164 init_var = Init_clone(init);
4165 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4166 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4167 long init_ref = (long)init_var.inner;
4168 if (init_var.is_owned) {
4171 //TODO: jobject obj = get object we can call against on j_calls->o
4172 return; //TODO: Call sync_routing_table on j_calls with instance obj, their_node_id_arr, init_ref);
4174 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
4175 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4176 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
4177 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
4178 LDKReplyChannelRange msg_var = msg;
4179 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4180 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4181 long msg_ref = (long)msg_var.inner;
4182 if (msg_var.is_owned) {
4185 //TODO: jobject obj = get object we can call against on j_calls->o
4186 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_reply_channel_range on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4187 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4191 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
4192 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4193 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
4194 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
4195 LDKReplyShortChannelIdsEnd msg_var = msg;
4196 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4197 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4198 long msg_ref = (long)msg_var.inner;
4199 if (msg_var.is_owned) {
4202 //TODO: jobject obj = get object we can call against on j_calls->o
4203 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_reply_short_channel_ids_end on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4204 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4208 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
4209 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4210 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
4211 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
4212 LDKQueryChannelRange msg_var = msg;
4213 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4214 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4215 long msg_ref = (long)msg_var.inner;
4216 if (msg_var.is_owned) {
4219 //TODO: jobject obj = get object we can call against on j_calls->o
4220 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_query_channel_range on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4221 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4225 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
4226 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4227 int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
4228 memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
4229 LDKQueryShortChannelIds msg_var = msg;
4230 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4231 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4232 long msg_ref = (long)msg_var.inner;
4233 if (msg_var.is_owned) {
4236 //TODO: jobject obj = get object we can call against on j_calls->o
4237 LDKCResult_NoneLightningErrorZ* ret; // TODO: Call handle_query_short_channel_ids on j_calls with instance obj, returning a pointer, their_node_id_arr, msg_ref);
4238 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
4242 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4243 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4244 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4245 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4246 return (void*) this_arg;
4248 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4249 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4250 atomic_init(&calls->refcnt, 1);
4251 //TODO: Assign calls->o from o
4253 LDKRoutingMessageHandler ret = {
4254 .this_arg = (void*) calls,
4255 .handle_node_announcement = handle_node_announcement_jcall,
4256 .handle_channel_announcement = handle_channel_announcement_jcall,
4257 .handle_channel_update = handle_channel_update_jcall,
4258 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4259 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4260 .get_next_node_announcements = get_next_node_announcements_jcall,
4261 .sync_routing_table = sync_routing_table_jcall,
4262 .handle_reply_channel_range = handle_reply_channel_range_jcall,
4263 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
4264 .handle_query_channel_range = handle_query_channel_range_jcall,
4265 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
4266 .free = LDKRoutingMessageHandler_JCalls_free,
4267 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(NULL, MessageSendEventsProvider),
4269 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4272 long LDKRoutingMessageHandler_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4273 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4274 *res_ptr = LDKRoutingMessageHandler_init(NULL, o, MessageSendEventsProvider);
4275 return (long)res_ptr;
4277 uint32_t RoutingMessageHandler_1handle_1node_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
4278 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4279 LDKNodeAnnouncement msg_conv;
4280 msg_conv.inner = (void*)(msg & (~1));
4281 msg_conv.is_owned = false;
4282 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4283 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4284 return (long)ret_conv;
4287 uint32_t RoutingMessageHandler_1handle_1channel_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
4288 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4289 LDKChannelAnnouncement msg_conv;
4290 msg_conv.inner = (void*)(msg & (~1));
4291 msg_conv.is_owned = false;
4292 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4293 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4294 return (long)ret_conv;
4297 uint32_t RoutingMessageHandler_1handle_1channel_1update(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
4298 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4299 LDKChannelUpdate msg_conv;
4300 msg_conv.inner = (void*)(msg & (~1));
4301 msg_conv.is_owned = false;
4302 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4303 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4304 return (long)ret_conv;
4307 void RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(void* ctx_TODO, uint32_t this_arg, uint32_t update) {
4308 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4309 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4310 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4313 uint32_tArray RoutingMessageHandler_1get_1next_1channel_1announcements(void* ctx_TODO, uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
4314 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4315 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4316 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
4317 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
4318 for (size_t l = 0; l < ret_var.datalen; l++) {
4319 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4320 *arr_conv_63_ref = ret_var.data[l];
4321 arr_conv_63_ref->a = ChannelAnnouncement_clone(&arr_conv_63_ref->a);
4322 arr_conv_63_ref->b = ChannelUpdate_clone(&arr_conv_63_ref->b);
4323 arr_conv_63_ref->c = ChannelUpdate_clone(&arr_conv_63_ref->c);
4324 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4330 uint32_tArray RoutingMessageHandler_1get_1next_1node_1announcements(void* ctx_TODO, uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
4331 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4332 LDKPublicKey starting_point_ref;
4333 CHECK(*starting_point.len == 33);
4334 memcpy(starting_point_ref.compressed_form, starting_point.len + 1, 33);
4335 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4336 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
4337 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
4338 for (size_t s = 0; s < ret_var.datalen; s++) {
4339 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4340 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4341 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4342 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4343 if (arr_conv_18_var.is_owned) {
4344 arr_conv_18_ref |= 1;
4346 ret_arr_ptr[s] = arr_conv_18_ref;
4352 void RoutingMessageHandler_1sync_1routing_1table(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
4353 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4354 LDKPublicKey their_node_id_ref;
4355 CHECK(*their_node_id.len == 33);
4356 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4358 init_conv.inner = (void*)(init & (~1));
4359 init_conv.is_owned = false;
4360 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
4363 uint32_t RoutingMessageHandler_1handle_1reply_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4364 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4365 LDKPublicKey their_node_id_ref;
4366 CHECK(*their_node_id.len == 33);
4367 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4368 LDKReplyChannelRange msg_conv;
4369 msg_conv.inner = (void*)(msg & (~1));
4370 msg_conv.is_owned = (msg & 1) || (msg == 0);
4371 if (msg_conv.inner != NULL)
4372 msg_conv = ReplyChannelRange_clone(&msg_conv);
4373 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4374 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4375 return (long)ret_conv;
4378 uint32_t RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4379 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4380 LDKPublicKey their_node_id_ref;
4381 CHECK(*their_node_id.len == 33);
4382 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4383 LDKReplyShortChannelIdsEnd msg_conv;
4384 msg_conv.inner = (void*)(msg & (~1));
4385 msg_conv.is_owned = (msg & 1) || (msg == 0);
4386 if (msg_conv.inner != NULL)
4387 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
4388 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4389 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4390 return (long)ret_conv;
4393 uint32_t RoutingMessageHandler_1handle_1query_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4394 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4395 LDKPublicKey their_node_id_ref;
4396 CHECK(*their_node_id.len == 33);
4397 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4398 LDKQueryChannelRange msg_conv;
4399 msg_conv.inner = (void*)(msg & (~1));
4400 msg_conv.is_owned = (msg & 1) || (msg == 0);
4401 if (msg_conv.inner != NULL)
4402 msg_conv = QueryChannelRange_clone(&msg_conv);
4403 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4404 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4405 return (long)ret_conv;
4408 uint32_t RoutingMessageHandler_1handle_1query_1short_1channel_1ids(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4409 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4410 LDKPublicKey their_node_id_ref;
4411 CHECK(*their_node_id.len == 33);
4412 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
4413 LDKQueryShortChannelIds msg_conv;
4414 msg_conv.inner = (void*)(msg & (~1));
4415 msg_conv.is_owned = (msg & 1) || (msg == 0);
4416 if (msg_conv.inner != NULL)
4417 msg_conv = QueryShortChannelIds_clone(&msg_conv);
4418 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
4419 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
4420 return (long)ret_conv;
4423 typedef struct LDKSocketDescriptor_JCalls {
4424 atomic_size_t refcnt;
4425 // TODO: Object pointer o;
4426 // TODO: Some kind of method pointer send_data_meth;
4427 // TODO: Some kind of method pointer disconnect_socket_meth;
4428 // TODO: Some kind of method pointer eq_meth;
4429 // TODO: Some kind of method pointer hash_meth;
4430 } LDKSocketDescriptor_JCalls;
4431 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4432 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4433 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4434 // TODO: do any release required for j_calls->o (refcnt-- in java, but may be redundant)
4438 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4439 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4440 LDKu8slice data_var = data;
4441 int8_tArray data_arr = { .len = MALLOC(data_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
4442 memcpy(data_arr.len + 1, data_var.data, data_var.datalen);
4443 //TODO: jobject obj = get object we can call against on j_calls->o
4444 return 0; //TODO: Call send_data on j_calls with instance obj, returning number, data_arr, resume_read);
4446 void disconnect_socket_jcall(void* this_arg) {
4447 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4448 //TODO: jobject obj = get object we can call against on j_calls->o
4449 return; //TODO: Call disconnect_socket on j_calls with instance obj);
4451 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
4452 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4453 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4454 *other_arg_clone = SocketDescriptor_clone(other_arg);
4455 //TODO: jobject obj = get object we can call against on j_calls->o
4456 return 0; //TODO: Call eq on j_calls with instance obj, returning boolean, (long)other_arg_clone);
4458 uint64_t hash_jcall(const void* this_arg) {
4459 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4460 //TODO: jobject obj = get object we can call against on j_calls->o
4461 return 0; //TODO: Call hash on j_calls with instance obj, returning number);
4463 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4464 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4465 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4466 return (void*) this_arg;
4468 static inline LDKSocketDescriptor LDKSocketDescriptor_init (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
4469 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4470 atomic_init(&calls->refcnt, 1);
4471 //TODO: Assign calls->o from o
4473 LDKSocketDescriptor ret = {
4474 .this_arg = (void*) calls,
4475 .send_data = send_data_jcall,
4476 .disconnect_socket = disconnect_socket_jcall,
4479 .clone = LDKSocketDescriptor_JCalls_clone,
4480 .free = LDKSocketDescriptor_JCalls_free,
4484 long LDKSocketDescriptor_1new (void* ctx_TODO, /*TODO: JS Object Reference */void* o) {
4485 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4486 *res_ptr = LDKSocketDescriptor_init(NULL, o);
4487 return (long)res_ptr;
4489 intptr_t SocketDescriptor_1send_1data(void* ctx_TODO, uint32_t this_arg, int8_tArray data, jboolean resume_read) {
4490 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4491 LDKu8slice data_ref;
4492 data_ref.datalen = *data.len;
4493 data_ref.data = (int8_t*)(data.len + 1);
4494 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4498 void SocketDescriptor_1disconnect_1socket(void* ctx_TODO, uint32_t this_arg) {
4499 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4500 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4503 int64_t SocketDescriptor_1hash(void* ctx_TODO, uint32_t this_arg) {
4504 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4505 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4509 void Transaction_1free(void* ctx_TODO, int8_tArray _res) {
4510 LDKTransaction _res_ref;
4511 _res_ref.datalen = *_res.len;
4512 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
4513 memcpy(_res_ref.data, _res.len + 1, _res_ref.datalen);
4514 _res_ref.data_is_owned = true;
4515 Transaction_free(_res_ref);
4518 void TxOut_1free(void* ctx_TODO, uint32_t _res) {
4519 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4521 TxOut_free(_res_conv);
4524 void CVec_1SpendableOutputDescriptorZ_1free(void* ctx_TODO, uint32_tArray _res) {
4525 LDKCVec_SpendableOutputDescriptorZ _res_constr;
4526 _res_constr.datalen = *_res.len;
4527 if (_res_constr.datalen > 0)
4528 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
4530 _res_constr.data = NULL;
4531 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
4532 for (size_t b = 0; b < _res_constr.datalen; b++) {
4533 uint32_t arr_conv_27 = _res_vals[b];
4534 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
4535 FREE((void*)arr_conv_27);
4536 _res_constr.data[b] = arr_conv_27_conv;
4538 CVec_SpendableOutputDescriptorZ_free(_res_constr);
4541 void CVec_1MessageSendEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
4542 LDKCVec_MessageSendEventZ _res_constr;
4543 _res_constr.datalen = *_res.len;
4544 if (_res_constr.datalen > 0)
4545 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4547 _res_constr.data = NULL;
4548 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
4549 for (size_t s = 0; s < _res_constr.datalen; s++) {
4550 uint32_t arr_conv_18 = _res_vals[s];
4551 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4552 FREE((void*)arr_conv_18);
4553 _res_constr.data[s] = arr_conv_18_conv;
4555 CVec_MessageSendEventZ_free(_res_constr);
4558 void CVec_1EventZ_1free(void* ctx_TODO, uint32_tArray _res) {
4559 LDKCVec_EventZ _res_constr;
4560 _res_constr.datalen = *_res.len;
4561 if (_res_constr.datalen > 0)
4562 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4564 _res_constr.data = NULL;
4565 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
4566 for (size_t h = 0; h < _res_constr.datalen; h++) {
4567 uint32_t arr_conv_7 = _res_vals[h];
4568 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4569 FREE((void*)arr_conv_7);
4570 _res_constr.data[h] = arr_conv_7_conv;
4572 CVec_EventZ_free(_res_constr);
4575 void C2Tuple_1usizeTransactionZ_1free(void* ctx_TODO, uint32_t _res) {
4576 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)_res;
4578 C2Tuple_usizeTransactionZ_free(_res_conv);
4581 uint32_t C2Tuple_1usizeTransactionZ_1new(void* ctx_TODO, intptr_t a, int8_tArray b) {
4582 LDKTransaction b_ref;
4583 b_ref.datalen = *b.len;
4584 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
4585 memcpy(b_ref.data, b.len + 1, b_ref.datalen);
4586 b_ref.data_is_owned = true;
4587 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4588 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
4589 // XXX: We likely need to clone here, but no _clone fn is available for Uint8Array
4590 return (long)ret_ref;
4593 void CVec_1C2Tuple_1usizeTransactionZZ_1free(void* ctx_TODO, uint32_tArray _res) {
4594 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
4595 _res_constr.datalen = *_res.len;
4596 if (_res_constr.datalen > 0)
4597 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4599 _res_constr.data = NULL;
4600 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
4601 for (size_t e = 0; e < _res_constr.datalen; e++) {
4602 uint32_t arr_conv_30 = _res_vals[e];
4603 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
4604 FREE((void*)arr_conv_30);
4605 _res_constr.data[e] = arr_conv_30_conv;
4607 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
4610 uint32_t CResult_1NoneChannelMonitorUpdateErrZ_1ok(void* ctx_TODO) {
4611 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4612 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
4613 return (long)ret_conv;
4616 uint32_t CResult_1NoneChannelMonitorUpdateErrZ_1err(void* ctx_TODO, uint32_t e) {
4617 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
4618 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4619 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
4620 return (long)ret_conv;
4623 void CResult_1NoneChannelMonitorUpdateErrZ_1free(void* ctx_TODO, uint32_t _res) {
4624 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)_res;
4626 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
4629 void CVec_1MonitorEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
4630 LDKCVec_MonitorEventZ _res_constr;
4631 _res_constr.datalen = *_res.len;
4632 if (_res_constr.datalen > 0)
4633 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4635 _res_constr.data = NULL;
4636 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
4637 for (size_t o = 0; o < _res_constr.datalen; o++) {
4638 uint32_t arr_conv_14 = _res_vals[o];
4639 LDKMonitorEvent arr_conv_14_conv;
4640 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4641 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4642 _res_constr.data[o] = arr_conv_14_conv;
4644 CVec_MonitorEventZ_free(_res_constr);
4647 uint32_t CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4648 LDKChannelMonitorUpdate o_conv;
4649 o_conv.inner = (void*)(o & (~1));
4650 o_conv.is_owned = (o & 1) || (o == 0);
4651 if (o_conv.inner != NULL)
4652 o_conv = ChannelMonitorUpdate_clone(&o_conv);
4653 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
4654 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
4655 return (long)ret_conv;
4658 uint32_t CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4659 LDKDecodeError e_conv;
4660 e_conv.inner = (void*)(e & (~1));
4661 e_conv.is_owned = (e & 1) || (e == 0);
4662 // Warning: we may need a move here but can't clone!
4663 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
4664 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
4665 return (long)ret_conv;
4668 void CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4669 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)_res;
4671 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
4674 uint32_t CResult_1NoneMonitorUpdateErrorZ_1ok(void* ctx_TODO) {
4675 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4676 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
4677 return (long)ret_conv;
4680 uint32_t CResult_1NoneMonitorUpdateErrorZ_1err(void* ctx_TODO, uint32_t e) {
4681 LDKMonitorUpdateError e_conv;
4682 e_conv.inner = (void*)(e & (~1));
4683 e_conv.is_owned = (e & 1) || (e == 0);
4684 // Warning: we may need a move here but can't clone!
4685 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4686 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
4687 return (long)ret_conv;
4690 void CResult_1NoneMonitorUpdateErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4691 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)_res;
4693 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
4696 void C2Tuple_1OutPointScriptZ_1free(void* ctx_TODO, uint32_t _res) {
4697 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)_res;
4699 C2Tuple_OutPointScriptZ_free(_res_conv);
4702 uint32_t C2Tuple_1OutPointScriptZ_1new(void* ctx_TODO, uint32_t a, int8_tArray b) {
4704 a_conv.inner = (void*)(a & (~1));
4705 a_conv.is_owned = (a & 1) || (a == 0);
4706 if (a_conv.inner != NULL)
4707 a_conv = OutPoint_clone(&a_conv);
4709 b_ref.datalen = *b.len;
4710 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4711 memcpy(b_ref.data, b.len + 1, b_ref.datalen);
4712 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4713 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
4714 ret_ref->a = OutPoint_clone(&ret_ref->a);
4715 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
4716 return (long)ret_ref;
4719 void CVec_1TransactionZ_1free(void* ctx_TODO, ptrArray _res) {
4720 LDKCVec_TransactionZ _res_constr;
4721 _res_constr.datalen = *_res.len;
4722 if (_res_constr.datalen > 0)
4723 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
4725 _res_constr.data = NULL;
4726 int8_tArray* _res_vals = (int8_tArray*)(_res.len + 1);
4727 for (size_t m = 0; m < _res_constr.datalen; m++) {
4728 int8_tArray arr_conv_12 = _res_vals[m];
4729 LDKTransaction arr_conv_12_ref;
4730 arr_conv_12_ref.datalen = *arr_conv_12.len;
4731 arr_conv_12_ref.data = MALLOC(arr_conv_12_ref.datalen, "LDKTransaction Bytes");
4732 memcpy(arr_conv_12_ref.data, arr_conv_12.len + 1, arr_conv_12_ref.datalen);
4733 arr_conv_12_ref.data_is_owned = true;
4734 _res_constr.data[m] = arr_conv_12_ref;
4736 CVec_TransactionZ_free(_res_constr);
4739 void C2Tuple_1u32TxOutZ_1free(void* ctx_TODO, uint32_t _res) {
4740 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)_res;
4742 C2Tuple_u32TxOutZ_free(_res_conv);
4745 uint32_t C2Tuple_1u32TxOutZ_1new(void* ctx_TODO, int32_t a, uint32_t b) {
4746 LDKTxOut b_conv = *(LDKTxOut*)b;
4748 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4749 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
4750 // XXX: We likely need to clone here, but no _clone fn is available for TxOut
4751 return (long)ret_ref;
4754 void CVec_1C2Tuple_1u32TxOutZZ_1free(void* ctx_TODO, uint32_tArray _res) {
4755 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
4756 _res_constr.datalen = *_res.len;
4757 if (_res_constr.datalen > 0)
4758 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4760 _res_constr.data = NULL;
4761 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
4762 for (size_t z = 0; z < _res_constr.datalen; z++) {
4763 uint32_t arr_conv_25 = _res_vals[z];
4764 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
4765 FREE((void*)arr_conv_25);
4766 _res_constr.data[z] = arr_conv_25_conv;
4768 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
4771 void C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(void* ctx_TODO, uint32_t _res) {
4772 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)_res;
4774 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
4777 uint32_t C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
4778 LDKThirtyTwoBytes a_ref;
4779 CHECK(*a.len == 32);
4780 memcpy(a_ref.data, a.len + 1, 32);
4781 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4782 b_constr.datalen = *b.len;
4783 if (b_constr.datalen > 0)
4784 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4786 b_constr.data = NULL;
4787 uint32_t* b_vals = (uint32_t*)(b.len + 1);
4788 for (size_t z = 0; z < b_constr.datalen; z++) {
4789 uint32_t arr_conv_25 = b_vals[z];
4790 LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
4791 FREE((void*)arr_conv_25);
4792 b_constr.data[z] = arr_conv_25_conv;
4794 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4795 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
4796 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
4797 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Number, TxOut>[]
4798 return (long)ret_ref;
4801 void CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(void* ctx_TODO, uint32_tArray _res) {
4802 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
4803 _res_constr.datalen = *_res.len;
4804 if (_res_constr.datalen > 0)
4805 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
4807 _res_constr.data = NULL;
4808 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
4809 for (size_t x = 0; x < _res_constr.datalen; x++) {
4810 uint32_t arr_conv_49 = _res_vals[x];
4811 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_conv_49;
4812 FREE((void*)arr_conv_49);
4813 _res_constr.data[x] = arr_conv_49_conv;
4815 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
4818 void C2Tuple_1BlockHashChannelMonitorZ_1free(void* ctx_TODO, uint32_t _res) {
4819 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)_res;
4821 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
4824 uint32_t C2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
4825 LDKThirtyTwoBytes a_ref;
4826 CHECK(*a.len == 32);
4827 memcpy(a_ref.data, a.len + 1, 32);
4828 LDKChannelMonitor b_conv;
4829 b_conv.inner = (void*)(b & (~1));
4830 b_conv.is_owned = (b & 1) || (b == 0);
4831 // Warning: we may need a move here but can't clone!
4832 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4833 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
4834 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
4835 // XXX: We likely need to clone here, but no _clone fn is available for ChannelMonitor
4836 return (long)ret_ref;
4839 uint32_t CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4840 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)o;
4842 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
4843 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
4844 return (long)ret_conv;
4847 uint32_t CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4848 LDKDecodeError e_conv;
4849 e_conv.inner = (void*)(e & (~1));
4850 e_conv.is_owned = (e & 1) || (e == 0);
4851 // Warning: we may need a move here but can't clone!
4852 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
4853 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
4854 return (long)ret_conv;
4857 void CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4858 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)_res;
4860 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
4863 void C2Tuple_1u64u64Z_1free(void* ctx_TODO, uint32_t _res) {
4864 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)_res;
4866 C2Tuple_u64u64Z_free(_res_conv);
4869 uint32_t C2Tuple_1u64u64Z_1new(void* ctx_TODO, int64_t a, int64_t b) {
4870 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4871 *ret_ref = C2Tuple_u64u64Z_new(a, b);
4872 return (long)ret_ref;
4875 uint32_t CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
4876 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)o;
4878 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
4879 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
4880 return (long)ret_conv;
4883 uint32_t CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
4884 LDKDecodeError e_conv;
4885 e_conv.inner = (void*)(e & (~1));
4886 e_conv.is_owned = (e & 1) || (e == 0);
4887 // Warning: we may need a move here but can't clone!
4888 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
4889 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
4890 return (long)ret_conv;
4893 void CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
4894 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)_res;
4896 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
4899 void CVec_1SignatureZ_1free(void* ctx_TODO, ptrArray _res) {
4900 LDKCVec_SignatureZ _res_constr;
4901 _res_constr.datalen = *_res.len;
4902 if (_res_constr.datalen > 0)
4903 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4905 _res_constr.data = NULL;
4906 int8_tArray* _res_vals = (int8_tArray*)(_res.len + 1);
4907 for (size_t m = 0; m < _res_constr.datalen; m++) {
4908 int8_tArray arr_conv_12 = _res_vals[m];
4909 LDKSignature arr_conv_12_ref;
4910 CHECK(*arr_conv_12.len == 64);
4911 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
4912 _res_constr.data[m] = arr_conv_12_ref;
4914 CVec_SignatureZ_free(_res_constr);
4917 void C2Tuple_1SignatureCVec_1SignatureZZ_1free(void* ctx_TODO, uint32_t _res) {
4918 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)_res;
4920 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
4923 uint32_t C2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, ptrArray b) {
4925 CHECK(*a.len == 64);
4926 memcpy(a_ref.compact_form, a.len + 1, 64);
4927 LDKCVec_SignatureZ b_constr;
4928 b_constr.datalen = *b.len;
4929 if (b_constr.datalen > 0)
4930 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4932 b_constr.data = NULL;
4933 int8_tArray* b_vals = (int8_tArray*)(b.len + 1);
4934 for (size_t m = 0; m < b_constr.datalen; m++) {
4935 int8_tArray arr_conv_12 = b_vals[m];
4936 LDKSignature arr_conv_12_ref;
4937 CHECK(*arr_conv_12.len == 64);
4938 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
4939 b_constr.data[m] = arr_conv_12_ref;
4941 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4942 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
4943 // XXX: We likely need to clone here, but no _clone fn is available for Uint8Array
4944 // XXX: We likely need to clone here, but no _clone fn is available for Uint8Array[]
4945 return (long)ret_ref;
4948 uint32_t CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(void* ctx_TODO, uint32_t o) {
4949 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)o;
4951 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4952 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
4953 return (long)ret_conv;
4956 uint32_t CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(void* ctx_TODO) {
4957 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4958 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4959 return (long)ret_conv;
4962 void CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(void* ctx_TODO, uint32_t _res) {
4963 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)_res;
4965 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
4968 uint32_t CResult_1SignatureNoneZ_1ok(void* ctx_TODO, int8_tArray o) {
4970 CHECK(*o.len == 64);
4971 memcpy(o_ref.compact_form, o.len + 1, 64);
4972 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4973 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
4974 return (long)ret_conv;
4977 uint32_t CResult_1SignatureNoneZ_1err(void* ctx_TODO) {
4978 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4979 *ret_conv = CResult_SignatureNoneZ_err();
4980 return (long)ret_conv;
4983 void CResult_1SignatureNoneZ_1free(void* ctx_TODO, uint32_t _res) {
4984 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)_res;
4986 CResult_SignatureNoneZ_free(_res_conv);
4989 uint32_t CResult_1CVec_1SignatureZNoneZ_1ok(void* ctx_TODO, ptrArray o) {
4990 LDKCVec_SignatureZ o_constr;
4991 o_constr.datalen = *o.len;
4992 if (o_constr.datalen > 0)
4993 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4995 o_constr.data = NULL;
4996 int8_tArray* o_vals = (int8_tArray*)(o.len + 1);
4997 for (size_t m = 0; m < o_constr.datalen; m++) {
4998 int8_tArray arr_conv_12 = o_vals[m];
4999 LDKSignature arr_conv_12_ref;
5000 CHECK(*arr_conv_12.len == 64);
5001 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
5002 o_constr.data[m] = arr_conv_12_ref;
5004 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5005 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
5006 return (long)ret_conv;
5009 uint32_t CResult_1CVec_1SignatureZNoneZ_1err(void* ctx_TODO) {
5010 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5011 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5012 return (long)ret_conv;
5015 void CResult_1CVec_1SignatureZNoneZ_1free(void* ctx_TODO, uint32_t _res) {
5016 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)_res;
5018 CResult_CVec_SignatureZNoneZ_free(_res_conv);
5021 uint32_t CResult_1ChanKeySignerDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5022 LDKChannelKeys o_conv = *(LDKChannelKeys*)o;
5023 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5024 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
5025 return (long)ret_conv;
5028 uint32_t CResult_1ChanKeySignerDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5029 LDKDecodeError e_conv;
5030 e_conv.inner = (void*)(e & (~1));
5031 e_conv.is_owned = (e & 1) || (e == 0);
5032 // Warning: we may need a move here but can't clone!
5033 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5034 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
5035 return (long)ret_conv;
5038 void CResult_1ChanKeySignerDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5039 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)_res;
5041 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
5044 uint32_t CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5045 LDKInMemoryChannelKeys o_conv;
5046 o_conv.inner = (void*)(o & (~1));
5047 o_conv.is_owned = (o & 1) || (o == 0);
5048 if (o_conv.inner != NULL)
5049 o_conv = InMemoryChannelKeys_clone(&o_conv);
5050 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5051 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
5052 return (long)ret_conv;
5055 uint32_t CResult_1InMemoryChannelKeysDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5056 LDKDecodeError e_conv;
5057 e_conv.inner = (void*)(e & (~1));
5058 e_conv.is_owned = (e & 1) || (e == 0);
5059 // Warning: we may need a move here but can't clone!
5060 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5061 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
5062 return (long)ret_conv;
5065 void CResult_1InMemoryChannelKeysDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5066 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)_res;
5068 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
5071 uint32_t CResult_1TxOutAccessErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5072 LDKTxOut o_conv = *(LDKTxOut*)o;
5074 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5075 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
5076 return (long)ret_conv;
5079 uint32_t CResult_1TxOutAccessErrorZ_1err(void* ctx_TODO, uint32_t e) {
5080 LDKAccessError e_conv = LDKAccessError_from_js(e);
5081 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5082 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
5083 return (long)ret_conv;
5086 void CResult_1TxOutAccessErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5087 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)_res;
5089 CResult_TxOutAccessErrorZ_free(_res_conv);
5092 uint32_t CResult_1NoneAPIErrorZ_1ok(void* ctx_TODO) {
5093 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5094 *ret_conv = CResult_NoneAPIErrorZ_ok();
5095 return (long)ret_conv;
5098 uint32_t CResult_1NoneAPIErrorZ_1err(void* ctx_TODO, uint32_t e) {
5099 LDKAPIError e_conv = *(LDKAPIError*)e;
5101 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5102 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
5103 return (long)ret_conv;
5106 void CResult_1NoneAPIErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5107 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)_res;
5109 CResult_NoneAPIErrorZ_free(_res_conv);
5112 void CVec_1ChannelDetailsZ_1free(void* ctx_TODO, uint32_tArray _res) {
5113 LDKCVec_ChannelDetailsZ _res_constr;
5114 _res_constr.datalen = *_res.len;
5115 if (_res_constr.datalen > 0)
5116 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
5118 _res_constr.data = NULL;
5119 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5120 for (size_t q = 0; q < _res_constr.datalen; q++) {
5121 uint32_t arr_conv_16 = _res_vals[q];
5122 LDKChannelDetails arr_conv_16_conv;
5123 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5124 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5125 _res_constr.data[q] = arr_conv_16_conv;
5127 CVec_ChannelDetailsZ_free(_res_constr);
5130 uint32_t CResult_1NonePaymentSendFailureZ_1ok(void* ctx_TODO) {
5131 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5132 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5133 return (long)ret_conv;
5136 uint32_t CResult_1NonePaymentSendFailureZ_1err(void* ctx_TODO, uint32_t e) {
5137 LDKPaymentSendFailure e_conv;
5138 e_conv.inner = (void*)(e & (~1));
5139 e_conv.is_owned = (e & 1) || (e == 0);
5140 // Warning: we may need a move here but can't clone!
5141 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5142 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
5143 return (long)ret_conv;
5146 void CResult_1NonePaymentSendFailureZ_1free(void* ctx_TODO, uint32_t _res) {
5147 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)_res;
5149 CResult_NonePaymentSendFailureZ_free(_res_conv);
5152 void CVec_1NetAddressZ_1free(void* ctx_TODO, uint32_tArray _res) {
5153 LDKCVec_NetAddressZ _res_constr;
5154 _res_constr.datalen = *_res.len;
5155 if (_res_constr.datalen > 0)
5156 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5158 _res_constr.data = NULL;
5159 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5160 for (size_t m = 0; m < _res_constr.datalen; m++) {
5161 uint32_t arr_conv_12 = _res_vals[m];
5162 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5163 FREE((void*)arr_conv_12);
5164 _res_constr.data[m] = arr_conv_12_conv;
5166 CVec_NetAddressZ_free(_res_constr);
5169 void CVec_1ChannelMonitorZ_1free(void* ctx_TODO, uint32_tArray _res) {
5170 LDKCVec_ChannelMonitorZ _res_constr;
5171 _res_constr.datalen = *_res.len;
5172 if (_res_constr.datalen > 0)
5173 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5175 _res_constr.data = NULL;
5176 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5177 for (size_t q = 0; q < _res_constr.datalen; q++) {
5178 uint32_t arr_conv_16 = _res_vals[q];
5179 LDKChannelMonitor arr_conv_16_conv;
5180 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5181 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5182 _res_constr.data[q] = arr_conv_16_conv;
5184 CVec_ChannelMonitorZ_free(_res_constr);
5187 void C2Tuple_1BlockHashChannelManagerZ_1free(void* ctx_TODO, uint32_t _res) {
5188 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)_res;
5190 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
5193 uint32_t C2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
5194 LDKThirtyTwoBytes a_ref;
5195 CHECK(*a.len == 32);
5196 memcpy(a_ref.data, a.len + 1, 32);
5197 LDKChannelManager b_conv;
5198 b_conv.inner = (void*)(b & (~1));
5199 b_conv.is_owned = (b & 1) || (b == 0);
5200 // Warning: we may need a move here but can't clone!
5201 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
5202 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
5203 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
5204 // XXX: We likely need to clone here, but no _clone fn is available for ChannelManager
5205 return (long)ret_ref;
5208 uint32_t CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5209 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)o;
5211 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
5212 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
5213 return (long)ret_conv;
5216 uint32_t CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5217 LDKDecodeError e_conv;
5218 e_conv.inner = (void*)(e & (~1));
5219 e_conv.is_owned = (e & 1) || (e == 0);
5220 // Warning: we may need a move here but can't clone!
5221 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
5222 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
5223 return (long)ret_conv;
5226 void CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5227 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)_res;
5229 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
5232 uint32_t CResult_1NetAddressu8Z_1ok(void* ctx_TODO, uint32_t o) {
5233 LDKNetAddress o_conv = *(LDKNetAddress*)o;
5235 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5236 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
5237 return (long)ret_conv;
5240 uint32_t CResult_1NetAddressu8Z_1err(void* ctx_TODO, int8_t e) {
5241 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5242 *ret_conv = CResult_NetAddressu8Z_err(e);
5243 return (long)ret_conv;
5246 void CResult_1NetAddressu8Z_1free(void* ctx_TODO, uint32_t _res) {
5247 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)_res;
5249 CResult_NetAddressu8Z_free(_res_conv);
5252 uint32_t CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5253 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)o;
5255 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
5256 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
5257 return (long)ret_conv;
5260 uint32_t CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5261 LDKDecodeError e_conv;
5262 e_conv.inner = (void*)(e & (~1));
5263 e_conv.is_owned = (e & 1) || (e == 0);
5264 // Warning: we may need a move here but can't clone!
5265 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
5266 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
5267 return (long)ret_conv;
5270 void CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5271 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)_res;
5273 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
5276 void CVec_1u64Z_1free(void* ctx_TODO, int64_tArray _res) {
5277 LDKCVec_u64Z _res_constr;
5278 _res_constr.datalen = *_res.len;
5279 if (_res_constr.datalen > 0)
5280 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
5282 _res_constr.data = NULL;
5283 int64_t* _res_vals = (int64_t*)(_res.len + 1);
5284 for (size_t i = 0; i < _res_constr.datalen; i++) {
5285 int64_t arr_conv_8 = _res_vals[i];
5286 _res_constr.data[i] = arr_conv_8;
5288 CVec_u64Z_free(_res_constr);
5291 void CVec_1UpdateAddHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5292 LDKCVec_UpdateAddHTLCZ _res_constr;
5293 _res_constr.datalen = *_res.len;
5294 if (_res_constr.datalen > 0)
5295 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5297 _res_constr.data = NULL;
5298 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5299 for (size_t p = 0; p < _res_constr.datalen; p++) {
5300 uint32_t arr_conv_15 = _res_vals[p];
5301 LDKUpdateAddHTLC arr_conv_15_conv;
5302 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5303 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5304 _res_constr.data[p] = arr_conv_15_conv;
5306 CVec_UpdateAddHTLCZ_free(_res_constr);
5309 void CVec_1UpdateFulfillHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5310 LDKCVec_UpdateFulfillHTLCZ _res_constr;
5311 _res_constr.datalen = *_res.len;
5312 if (_res_constr.datalen > 0)
5313 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5315 _res_constr.data = NULL;
5316 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5317 for (size_t t = 0; t < _res_constr.datalen; t++) {
5318 uint32_t arr_conv_19 = _res_vals[t];
5319 LDKUpdateFulfillHTLC arr_conv_19_conv;
5320 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5321 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5322 _res_constr.data[t] = arr_conv_19_conv;
5324 CVec_UpdateFulfillHTLCZ_free(_res_constr);
5327 void CVec_1UpdateFailHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5328 LDKCVec_UpdateFailHTLCZ _res_constr;
5329 _res_constr.datalen = *_res.len;
5330 if (_res_constr.datalen > 0)
5331 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5333 _res_constr.data = NULL;
5334 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5335 for (size_t q = 0; q < _res_constr.datalen; q++) {
5336 uint32_t arr_conv_16 = _res_vals[q];
5337 LDKUpdateFailHTLC arr_conv_16_conv;
5338 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5339 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5340 _res_constr.data[q] = arr_conv_16_conv;
5342 CVec_UpdateFailHTLCZ_free(_res_constr);
5345 void CVec_1UpdateFailMalformedHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
5346 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
5347 _res_constr.datalen = *_res.len;
5348 if (_res_constr.datalen > 0)
5349 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5351 _res_constr.data = NULL;
5352 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5353 for (size_t z = 0; z < _res_constr.datalen; z++) {
5354 uint32_t arr_conv_25 = _res_vals[z];
5355 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5356 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5357 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5358 _res_constr.data[z] = arr_conv_25_conv;
5360 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
5363 uint32_t CResult_1boolLightningErrorZ_1ok(void* ctx_TODO, jboolean o) {
5364 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5365 *ret_conv = CResult_boolLightningErrorZ_ok(o);
5366 return (long)ret_conv;
5369 uint32_t CResult_1boolLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
5370 LDKLightningError e_conv;
5371 e_conv.inner = (void*)(e & (~1));
5372 e_conv.is_owned = (e & 1) || (e == 0);
5373 // Warning: we may need a move here but can't clone!
5374 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5375 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
5376 return (long)ret_conv;
5379 void CResult_1boolLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5380 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)_res;
5382 CResult_boolLightningErrorZ_free(_res_conv);
5385 void C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(void* ctx_TODO, uint32_t _res) {
5386 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)_res;
5388 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
5391 uint32_t C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(void* ctx_TODO, uint32_t a, uint32_t b, uint32_t c) {
5392 LDKChannelAnnouncement a_conv;
5393 a_conv.inner = (void*)(a & (~1));
5394 a_conv.is_owned = (a & 1) || (a == 0);
5395 if (a_conv.inner != NULL)
5396 a_conv = ChannelAnnouncement_clone(&a_conv);
5397 LDKChannelUpdate b_conv;
5398 b_conv.inner = (void*)(b & (~1));
5399 b_conv.is_owned = (b & 1) || (b == 0);
5400 if (b_conv.inner != NULL)
5401 b_conv = ChannelUpdate_clone(&b_conv);
5402 LDKChannelUpdate c_conv;
5403 c_conv.inner = (void*)(c & (~1));
5404 c_conv.is_owned = (c & 1) || (c == 0);
5405 if (c_conv.inner != NULL)
5406 c_conv = ChannelUpdate_clone(&c_conv);
5407 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5408 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5409 ret_ref->a = ChannelAnnouncement_clone(&ret_ref->a);
5410 ret_ref->b = ChannelUpdate_clone(&ret_ref->b);
5411 ret_ref->c = ChannelUpdate_clone(&ret_ref->c);
5412 return (long)ret_ref;
5415 void CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(void* ctx_TODO, uint32_tArray _res) {
5416 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
5417 _res_constr.datalen = *_res.len;
5418 if (_res_constr.datalen > 0)
5419 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5421 _res_constr.data = NULL;
5422 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5423 for (size_t l = 0; l < _res_constr.datalen; l++) {
5424 uint32_t arr_conv_63 = _res_vals[l];
5425 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5426 FREE((void*)arr_conv_63);
5427 _res_constr.data[l] = arr_conv_63_conv;
5429 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
5432 void CVec_1NodeAnnouncementZ_1free(void* ctx_TODO, uint32_tArray _res) {
5433 LDKCVec_NodeAnnouncementZ _res_constr;
5434 _res_constr.datalen = *_res.len;
5435 if (_res_constr.datalen > 0)
5436 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5438 _res_constr.data = NULL;
5439 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
5440 for (size_t s = 0; s < _res_constr.datalen; s++) {
5441 uint32_t arr_conv_18 = _res_vals[s];
5442 LDKNodeAnnouncement arr_conv_18_conv;
5443 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5444 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5445 _res_constr.data[s] = arr_conv_18_conv;
5447 CVec_NodeAnnouncementZ_free(_res_constr);
5450 uint32_t CResult_1NoneLightningErrorZ_1ok(void* ctx_TODO) {
5451 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5452 *ret_conv = CResult_NoneLightningErrorZ_ok();
5453 return (long)ret_conv;
5456 uint32_t CResult_1NoneLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
5457 LDKLightningError e_conv;
5458 e_conv.inner = (void*)(e & (~1));
5459 e_conv.is_owned = (e & 1) || (e == 0);
5460 // Warning: we may need a move here but can't clone!
5461 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5462 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
5463 return (long)ret_conv;
5466 void CResult_1NoneLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5467 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)_res;
5469 CResult_NoneLightningErrorZ_free(_res_conv);
5472 uint32_t CResult_1ChannelReestablishDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5473 LDKChannelReestablish o_conv;
5474 o_conv.inner = (void*)(o & (~1));
5475 o_conv.is_owned = (o & 1) || (o == 0);
5476 if (o_conv.inner != NULL)
5477 o_conv = ChannelReestablish_clone(&o_conv);
5478 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
5479 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
5480 return (long)ret_conv;
5483 uint32_t CResult_1ChannelReestablishDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5484 LDKDecodeError e_conv;
5485 e_conv.inner = (void*)(e & (~1));
5486 e_conv.is_owned = (e & 1) || (e == 0);
5487 // Warning: we may need a move here but can't clone!
5488 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
5489 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
5490 return (long)ret_conv;
5493 void CResult_1ChannelReestablishDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5494 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)_res;
5496 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
5499 uint32_t CResult_1InitDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5501 o_conv.inner = (void*)(o & (~1));
5502 o_conv.is_owned = (o & 1) || (o == 0);
5503 if (o_conv.inner != NULL)
5504 o_conv = Init_clone(&o_conv);
5505 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
5506 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
5507 return (long)ret_conv;
5510 uint32_t CResult_1InitDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5511 LDKDecodeError e_conv;
5512 e_conv.inner = (void*)(e & (~1));
5513 e_conv.is_owned = (e & 1) || (e == 0);
5514 // Warning: we may need a move here but can't clone!
5515 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
5516 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
5517 return (long)ret_conv;
5520 void CResult_1InitDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5521 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)_res;
5523 CResult_InitDecodeErrorZ_free(_res_conv);
5526 uint32_t CResult_1PingDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5528 o_conv.inner = (void*)(o & (~1));
5529 o_conv.is_owned = (o & 1) || (o == 0);
5530 if (o_conv.inner != NULL)
5531 o_conv = Ping_clone(&o_conv);
5532 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
5533 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
5534 return (long)ret_conv;
5537 uint32_t CResult_1PingDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5538 LDKDecodeError e_conv;
5539 e_conv.inner = (void*)(e & (~1));
5540 e_conv.is_owned = (e & 1) || (e == 0);
5541 // Warning: we may need a move here but can't clone!
5542 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
5543 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
5544 return (long)ret_conv;
5547 void CResult_1PingDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5548 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)_res;
5550 CResult_PingDecodeErrorZ_free(_res_conv);
5553 uint32_t CResult_1PongDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5555 o_conv.inner = (void*)(o & (~1));
5556 o_conv.is_owned = (o & 1) || (o == 0);
5557 if (o_conv.inner != NULL)
5558 o_conv = Pong_clone(&o_conv);
5559 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
5560 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
5561 return (long)ret_conv;
5564 uint32_t CResult_1PongDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5565 LDKDecodeError e_conv;
5566 e_conv.inner = (void*)(e & (~1));
5567 e_conv.is_owned = (e & 1) || (e == 0);
5568 // Warning: we may need a move here but can't clone!
5569 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
5570 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
5571 return (long)ret_conv;
5574 void CResult_1PongDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5575 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)_res;
5577 CResult_PongDecodeErrorZ_free(_res_conv);
5580 uint32_t CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5581 LDKUnsignedChannelAnnouncement o_conv;
5582 o_conv.inner = (void*)(o & (~1));
5583 o_conv.is_owned = (o & 1) || (o == 0);
5584 if (o_conv.inner != NULL)
5585 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
5586 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
5587 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
5588 return (long)ret_conv;
5591 uint32_t CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5592 LDKDecodeError e_conv;
5593 e_conv.inner = (void*)(e & (~1));
5594 e_conv.is_owned = (e & 1) || (e == 0);
5595 // Warning: we may need a move here but can't clone!
5596 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
5597 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
5598 return (long)ret_conv;
5601 void CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5602 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)_res;
5604 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
5607 uint32_t CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5608 LDKUnsignedChannelUpdate o_conv;
5609 o_conv.inner = (void*)(o & (~1));
5610 o_conv.is_owned = (o & 1) || (o == 0);
5611 if (o_conv.inner != NULL)
5612 o_conv = UnsignedChannelUpdate_clone(&o_conv);
5613 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
5614 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
5615 return (long)ret_conv;
5618 uint32_t CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5619 LDKDecodeError e_conv;
5620 e_conv.inner = (void*)(e & (~1));
5621 e_conv.is_owned = (e & 1) || (e == 0);
5622 // Warning: we may need a move here but can't clone!
5623 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
5624 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
5625 return (long)ret_conv;
5628 void CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5629 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)_res;
5631 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
5634 uint32_t CResult_1ErrorMessageDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5635 LDKErrorMessage o_conv;
5636 o_conv.inner = (void*)(o & (~1));
5637 o_conv.is_owned = (o & 1) || (o == 0);
5638 if (o_conv.inner != NULL)
5639 o_conv = ErrorMessage_clone(&o_conv);
5640 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
5641 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
5642 return (long)ret_conv;
5645 uint32_t CResult_1ErrorMessageDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5646 LDKDecodeError e_conv;
5647 e_conv.inner = (void*)(e & (~1));
5648 e_conv.is_owned = (e & 1) || (e == 0);
5649 // Warning: we may need a move here but can't clone!
5650 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
5651 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
5652 return (long)ret_conv;
5655 void CResult_1ErrorMessageDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5656 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)_res;
5658 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
5661 uint32_t CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5662 LDKUnsignedNodeAnnouncement o_conv;
5663 o_conv.inner = (void*)(o & (~1));
5664 o_conv.is_owned = (o & 1) || (o == 0);
5665 if (o_conv.inner != NULL)
5666 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
5667 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
5668 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
5669 return (long)ret_conv;
5672 uint32_t CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5673 LDKDecodeError e_conv;
5674 e_conv.inner = (void*)(e & (~1));
5675 e_conv.is_owned = (e & 1) || (e == 0);
5676 // Warning: we may need a move here but can't clone!
5677 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
5678 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
5679 return (long)ret_conv;
5682 void CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5683 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)_res;
5685 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
5688 uint32_t CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5689 LDKQueryShortChannelIds o_conv;
5690 o_conv.inner = (void*)(o & (~1));
5691 o_conv.is_owned = (o & 1) || (o == 0);
5692 if (o_conv.inner != NULL)
5693 o_conv = QueryShortChannelIds_clone(&o_conv);
5694 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
5695 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
5696 return (long)ret_conv;
5699 uint32_t CResult_1QueryShortChannelIdsDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5700 LDKDecodeError e_conv;
5701 e_conv.inner = (void*)(e & (~1));
5702 e_conv.is_owned = (e & 1) || (e == 0);
5703 // Warning: we may need a move here but can't clone!
5704 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
5705 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
5706 return (long)ret_conv;
5709 void CResult_1QueryShortChannelIdsDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5710 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)_res;
5712 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
5715 uint32_t CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5716 LDKReplyShortChannelIdsEnd o_conv;
5717 o_conv.inner = (void*)(o & (~1));
5718 o_conv.is_owned = (o & 1) || (o == 0);
5719 if (o_conv.inner != NULL)
5720 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
5721 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
5722 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
5723 return (long)ret_conv;
5726 uint32_t CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5727 LDKDecodeError e_conv;
5728 e_conv.inner = (void*)(e & (~1));
5729 e_conv.is_owned = (e & 1) || (e == 0);
5730 // Warning: we may need a move here but can't clone!
5731 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
5732 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
5733 return (long)ret_conv;
5736 void CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5737 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)_res;
5739 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
5742 uint32_t CResult_1QueryChannelRangeDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5743 LDKQueryChannelRange o_conv;
5744 o_conv.inner = (void*)(o & (~1));
5745 o_conv.is_owned = (o & 1) || (o == 0);
5746 if (o_conv.inner != NULL)
5747 o_conv = QueryChannelRange_clone(&o_conv);
5748 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
5749 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
5750 return (long)ret_conv;
5753 uint32_t CResult_1QueryChannelRangeDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5754 LDKDecodeError e_conv;
5755 e_conv.inner = (void*)(e & (~1));
5756 e_conv.is_owned = (e & 1) || (e == 0);
5757 // Warning: we may need a move here but can't clone!
5758 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
5759 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
5760 return (long)ret_conv;
5763 void CResult_1QueryChannelRangeDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5764 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)_res;
5766 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
5769 uint32_t CResult_1ReplyChannelRangeDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5770 LDKReplyChannelRange o_conv;
5771 o_conv.inner = (void*)(o & (~1));
5772 o_conv.is_owned = (o & 1) || (o == 0);
5773 if (o_conv.inner != NULL)
5774 o_conv = ReplyChannelRange_clone(&o_conv);
5775 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
5776 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
5777 return (long)ret_conv;
5780 uint32_t CResult_1ReplyChannelRangeDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5781 LDKDecodeError e_conv;
5782 e_conv.inner = (void*)(e & (~1));
5783 e_conv.is_owned = (e & 1) || (e == 0);
5784 // Warning: we may need a move here but can't clone!
5785 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
5786 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
5787 return (long)ret_conv;
5790 void CResult_1ReplyChannelRangeDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5791 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)_res;
5793 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
5796 uint32_t CResult_1GossipTimestampFilterDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5797 LDKGossipTimestampFilter o_conv;
5798 o_conv.inner = (void*)(o & (~1));
5799 o_conv.is_owned = (o & 1) || (o == 0);
5800 if (o_conv.inner != NULL)
5801 o_conv = GossipTimestampFilter_clone(&o_conv);
5802 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
5803 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
5804 return (long)ret_conv;
5807 uint32_t CResult_1GossipTimestampFilterDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
5808 LDKDecodeError e_conv;
5809 e_conv.inner = (void*)(e & (~1));
5810 e_conv.is_owned = (e & 1) || (e == 0);
5811 // Warning: we may need a move here but can't clone!
5812 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
5813 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
5814 return (long)ret_conv;
5817 void CResult_1GossipTimestampFilterDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5818 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)_res;
5820 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
5823 void CVec_1PublicKeyZ_1free(void* ctx_TODO, ptrArray _res) {
5824 LDKCVec_PublicKeyZ _res_constr;
5825 _res_constr.datalen = *_res.len;
5826 if (_res_constr.datalen > 0)
5827 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5829 _res_constr.data = NULL;
5830 int8_tArray* _res_vals = (int8_tArray*)(_res.len + 1);
5831 for (size_t m = 0; m < _res_constr.datalen; m++) {
5832 int8_tArray arr_conv_12 = _res_vals[m];
5833 LDKPublicKey arr_conv_12_ref;
5834 CHECK(*arr_conv_12.len == 33);
5835 memcpy(arr_conv_12_ref.compressed_form, arr_conv_12.len + 1, 33);
5836 _res_constr.data[m] = arr_conv_12_ref;
5838 CVec_PublicKeyZ_free(_res_constr);
5841 void CVec_1u8Z_1free(void* ctx_TODO, int8_tArray _res) {
5842 LDKCVec_u8Z _res_ref;
5843 _res_ref.datalen = *_res.len;
5844 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
5845 memcpy(_res_ref.data, _res.len + 1, _res_ref.datalen);
5846 CVec_u8Z_free(_res_ref);
5849 uint32_t CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
5851 o_ref.datalen = *o.len;
5852 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
5853 memcpy(o_ref.data, o.len + 1, o_ref.datalen);
5854 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5855 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
5856 return (long)ret_conv;
5859 uint32_t CResult_1CVec_1u8ZPeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
5860 LDKPeerHandleError e_conv;
5861 e_conv.inner = (void*)(e & (~1));
5862 e_conv.is_owned = (e & 1) || (e == 0);
5863 // Warning: we may need a move here but can't clone!
5864 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5865 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
5866 return (long)ret_conv;
5869 void CResult_1CVec_1u8ZPeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5870 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)_res;
5872 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
5875 uint32_t CResult_1NonePeerHandleErrorZ_1ok(void* ctx_TODO) {
5876 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5877 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5878 return (long)ret_conv;
5881 uint32_t CResult_1NonePeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
5882 LDKPeerHandleError e_conv;
5883 e_conv.inner = (void*)(e & (~1));
5884 e_conv.is_owned = (e & 1) || (e == 0);
5885 // Warning: we may need a move here but can't clone!
5886 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5887 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
5888 return (long)ret_conv;
5891 void CResult_1NonePeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5892 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)_res;
5894 CResult_NonePeerHandleErrorZ_free(_res_conv);
5897 uint32_t CResult_1boolPeerHandleErrorZ_1ok(void* ctx_TODO, jboolean o) {
5898 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5899 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
5900 return (long)ret_conv;
5903 uint32_t CResult_1boolPeerHandleErrorZ_1err(void* ctx_TODO, uint32_t e) {
5904 LDKPeerHandleError e_conv;
5905 e_conv.inner = (void*)(e & (~1));
5906 e_conv.is_owned = (e & 1) || (e == 0);
5907 // Warning: we may need a move here but can't clone!
5908 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5909 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
5910 return (long)ret_conv;
5913 void CResult_1boolPeerHandleErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5914 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)_res;
5916 CResult_boolPeerHandleErrorZ_free(_res_conv);
5919 uint32_t CResult_1SecretKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
5921 CHECK(*o.len == 32);
5922 memcpy(o_ref.bytes, o.len + 1, 32);
5923 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
5924 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
5925 return (long)ret_conv;
5928 uint32_t CResult_1SecretKeySecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
5929 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5930 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
5931 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
5932 return (long)ret_conv;
5935 void CResult_1SecretKeySecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5936 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)_res;
5938 CResult_SecretKeySecpErrorZ_free(_res_conv);
5941 uint32_t CResult_1PublicKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
5943 CHECK(*o.len == 33);
5944 memcpy(o_ref.compressed_form, o.len + 1, 33);
5945 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
5946 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
5947 return (long)ret_conv;
5950 uint32_t CResult_1PublicKeySecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
5951 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5952 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
5953 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
5954 return (long)ret_conv;
5957 void CResult_1PublicKeySecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5958 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)_res;
5960 CResult_PublicKeySecpErrorZ_free(_res_conv);
5963 uint32_t CResult_1TxCreationKeysSecpErrorZ_1ok(void* ctx_TODO, uint32_t o) {
5964 LDKTxCreationKeys o_conv;
5965 o_conv.inner = (void*)(o & (~1));
5966 o_conv.is_owned = (o & 1) || (o == 0);
5967 if (o_conv.inner != NULL)
5968 o_conv = TxCreationKeys_clone(&o_conv);
5969 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
5970 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
5971 return (long)ret_conv;
5974 uint32_t CResult_1TxCreationKeysSecpErrorZ_1err(void* ctx_TODO, uint32_t e) {
5975 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5976 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
5977 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
5978 return (long)ret_conv;
5981 void CResult_1TxCreationKeysSecpErrorZ_1free(void* ctx_TODO, uint32_t _res) {
5982 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)_res;
5984 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
5987 uint32_t CResult_1TrustedCommitmentTransactionNoneZ_1ok(void* ctx_TODO, uint32_t o) {
5988 LDKTrustedCommitmentTransaction o_conv;
5989 o_conv.inner = (void*)(o & (~1));
5990 o_conv.is_owned = (o & 1) || (o == 0);
5991 // Warning: we may need a move here but can't clone!
5992 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5993 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
5994 return (long)ret_conv;
5997 uint32_t CResult_1TrustedCommitmentTransactionNoneZ_1err(void* ctx_TODO) {
5998 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5999 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6000 return (long)ret_conv;
6003 void CResult_1TrustedCommitmentTransactionNoneZ_1free(void* ctx_TODO, uint32_t _res) {
6004 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)_res;
6006 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
6009 void CVec_1RouteHopZ_1free(void* ctx_TODO, uint32_tArray _res) {
6010 LDKCVec_RouteHopZ _res_constr;
6011 _res_constr.datalen = *_res.len;
6012 if (_res_constr.datalen > 0)
6013 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6015 _res_constr.data = NULL;
6016 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
6017 for (size_t k = 0; k < _res_constr.datalen; k++) {
6018 uint32_t arr_conv_10 = _res_vals[k];
6019 LDKRouteHop arr_conv_10_conv;
6020 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6021 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6022 _res_constr.data[k] = arr_conv_10_conv;
6024 CVec_RouteHopZ_free(_res_constr);
6027 void CVec_1CVec_1RouteHopZZ_1free(void* ctx_TODO, ptrArray _res) {
6028 LDKCVec_CVec_RouteHopZZ _res_constr;
6029 _res_constr.datalen = *_res.len;
6030 if (_res_constr.datalen > 0)
6031 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
6033 _res_constr.data = NULL;
6034 uint32_tArray* _res_vals = (uint32_tArray*)(_res.len + 1);
6035 for (size_t m = 0; m < _res_constr.datalen; m++) {
6036 uint32_tArray arr_conv_12 = _res_vals[m];
6037 LDKCVec_RouteHopZ arr_conv_12_constr;
6038 arr_conv_12_constr.datalen = *arr_conv_12.len;
6039 if (arr_conv_12_constr.datalen > 0)
6040 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
6042 arr_conv_12_constr.data = NULL;
6043 uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12.len + 1);
6044 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
6045 uint32_t arr_conv_10 = arr_conv_12_vals[k];
6046 LDKRouteHop arr_conv_10_conv;
6047 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
6048 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
6049 arr_conv_12_constr.data[k] = arr_conv_10_conv;
6051 _res_constr.data[m] = arr_conv_12_constr;
6053 CVec_CVec_RouteHopZZ_free(_res_constr);
6056 uint32_t CResult_1RouteDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6058 o_conv.inner = (void*)(o & (~1));
6059 o_conv.is_owned = (o & 1) || (o == 0);
6060 if (o_conv.inner != NULL)
6061 o_conv = Route_clone(&o_conv);
6062 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6063 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
6064 return (long)ret_conv;
6067 uint32_t CResult_1RouteDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6068 LDKDecodeError e_conv;
6069 e_conv.inner = (void*)(e & (~1));
6070 e_conv.is_owned = (e & 1) || (e == 0);
6071 // Warning: we may need a move here but can't clone!
6072 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
6073 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
6074 return (long)ret_conv;
6077 void CResult_1RouteDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6078 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)_res;
6080 CResult_RouteDecodeErrorZ_free(_res_conv);
6083 void CVec_1RouteHintZ_1free(void* ctx_TODO, uint32_tArray _res) {
6084 LDKCVec_RouteHintZ _res_constr;
6085 _res_constr.datalen = *_res.len;
6086 if (_res_constr.datalen > 0)
6087 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
6089 _res_constr.data = NULL;
6090 uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
6091 for (size_t l = 0; l < _res_constr.datalen; l++) {
6092 uint32_t arr_conv_11 = _res_vals[l];
6093 LDKRouteHint arr_conv_11_conv;
6094 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
6095 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
6096 _res_constr.data[l] = arr_conv_11_conv;
6098 CVec_RouteHintZ_free(_res_constr);
6101 uint32_t CResult_1RouteLightningErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6103 o_conv.inner = (void*)(o & (~1));
6104 o_conv.is_owned = (o & 1) || (o == 0);
6105 if (o_conv.inner != NULL)
6106 o_conv = Route_clone(&o_conv);
6107 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6108 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
6109 return (long)ret_conv;
6112 uint32_t CResult_1RouteLightningErrorZ_1err(void* ctx_TODO, uint32_t e) {
6113 LDKLightningError e_conv;
6114 e_conv.inner = (void*)(e & (~1));
6115 e_conv.is_owned = (e & 1) || (e == 0);
6116 // Warning: we may need a move here but can't clone!
6117 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6118 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
6119 return (long)ret_conv;
6122 void CResult_1RouteLightningErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6123 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)_res;
6125 CResult_RouteLightningErrorZ_free(_res_conv);
6128 uint32_t CResult_1RoutingFeesDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6129 LDKRoutingFees o_conv;
6130 o_conv.inner = (void*)(o & (~1));
6131 o_conv.is_owned = (o & 1) || (o == 0);
6132 if (o_conv.inner != NULL)
6133 o_conv = RoutingFees_clone(&o_conv);
6134 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6135 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
6136 return (long)ret_conv;
6139 uint32_t CResult_1RoutingFeesDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6140 LDKDecodeError e_conv;
6141 e_conv.inner = (void*)(e & (~1));
6142 e_conv.is_owned = (e & 1) || (e == 0);
6143 // Warning: we may need a move here but can't clone!
6144 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6145 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
6146 return (long)ret_conv;
6149 void CResult_1RoutingFeesDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6150 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)_res;
6152 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
6155 uint32_t CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6156 LDKNodeAnnouncementInfo o_conv;
6157 o_conv.inner = (void*)(o & (~1));
6158 o_conv.is_owned = (o & 1) || (o == 0);
6159 // Warning: we may need a move here but can't clone!
6160 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6161 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
6162 return (long)ret_conv;
6165 uint32_t CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6166 LDKDecodeError e_conv;
6167 e_conv.inner = (void*)(e & (~1));
6168 e_conv.is_owned = (e & 1) || (e == 0);
6169 // Warning: we may need a move here but can't clone!
6170 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6171 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
6172 return (long)ret_conv;
6175 void CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6176 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)_res;
6178 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
6181 uint32_t CResult_1NodeInfoDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6183 o_conv.inner = (void*)(o & (~1));
6184 o_conv.is_owned = (o & 1) || (o == 0);
6185 // Warning: we may need a move here but can't clone!
6186 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6187 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
6188 return (long)ret_conv;
6191 uint32_t CResult_1NodeInfoDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6192 LDKDecodeError e_conv;
6193 e_conv.inner = (void*)(e & (~1));
6194 e_conv.is_owned = (e & 1) || (e == 0);
6195 // Warning: we may need a move here but can't clone!
6196 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6197 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6198 return (long)ret_conv;
6201 void CResult_1NodeInfoDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6202 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)_res;
6204 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
6207 uint32_t CResult_1NetworkGraphDecodeErrorZ_1ok(void* ctx_TODO, uint32_t o) {
6208 LDKNetworkGraph o_conv;
6209 o_conv.inner = (void*)(o & (~1));
6210 o_conv.is_owned = (o & 1) || (o == 0);
6211 // Warning: we may need a move here but can't clone!
6212 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6213 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
6214 return (long)ret_conv;
6217 uint32_t CResult_1NetworkGraphDecodeErrorZ_1err(void* ctx_TODO, uint32_t e) {
6218 LDKDecodeError e_conv;
6219 e_conv.inner = (void*)(e & (~1));
6220 e_conv.is_owned = (e & 1) || (e == 0);
6221 // Warning: we may need a move here but can't clone!
6222 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6223 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
6224 return (long)ret_conv;
6227 void CResult_1NetworkGraphDecodeErrorZ_1free(void* ctx_TODO, uint32_t _res) {
6228 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)_res;
6230 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
6233 void Event_1free(void* ctx_TODO, uint32_t this_ptr) {
6234 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
6235 FREE((void*)this_ptr);
6236 Event_free(this_ptr_conv);
6239 uint32_t Event_1clone(void* ctx_TODO, uint32_t orig) {
6240 LDKEvent* orig_conv = (LDKEvent*)orig;
6241 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6242 *ret_copy = Event_clone(orig_conv);
6243 long ret_ref = (long)ret_copy;
6247 int8_tArray Event_1write(void* ctx_TODO, uint32_t obj) {
6248 LDKEvent* obj_conv = (LDKEvent*)obj;
6249 LDKCVec_u8Z arg_var = Event_write(obj_conv);
6250 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
6251 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
6252 CVec_u8Z_free(arg_var);
6256 void MessageSendEvent_1free(void* ctx_TODO, uint32_t this_ptr) {
6257 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
6258 FREE((void*)this_ptr);
6259 MessageSendEvent_free(this_ptr_conv);
6262 uint32_t MessageSendEvent_1clone(void* ctx_TODO, uint32_t orig) {
6263 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
6264 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6265 *ret_copy = MessageSendEvent_clone(orig_conv);
6266 long ret_ref = (long)ret_copy;
6270 void MessageSendEventsProvider_1free(void* ctx_TODO, uint32_t this_ptr) {
6271 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
6272 FREE((void*)this_ptr);
6273 MessageSendEventsProvider_free(this_ptr_conv);
6276 void EventsProvider_1free(void* ctx_TODO, uint32_t this_ptr) {
6277 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
6278 FREE((void*)this_ptr);
6279 EventsProvider_free(this_ptr_conv);
6282 void APIError_1free(void* ctx_TODO, uint32_t this_ptr) {
6283 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
6284 FREE((void*)this_ptr);
6285 APIError_free(this_ptr_conv);
6288 uint32_t APIError_1clone(void* ctx_TODO, uint32_t orig) {
6289 LDKAPIError* orig_conv = (LDKAPIError*)orig;
6290 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6291 *ret_copy = APIError_clone(orig_conv);
6292 long ret_ref = (long)ret_copy;
6296 uint32_t Level_1clone(void* ctx_TODO, uint32_t orig) {
6297 LDKLevel* orig_conv = (LDKLevel*)orig;
6298 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
6302 uint32_t Level_1max(void* ctx_TODO) {
6303 uint32_t ret_conv = LDKLevel_to_js(Level_max());
6307 void Logger_1free(void* ctx_TODO, uint32_t this_ptr) {
6308 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
6309 FREE((void*)this_ptr);
6310 Logger_free(this_ptr_conv);
6313 void ChannelHandshakeConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
6314 LDKChannelHandshakeConfig this_ptr_conv;
6315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6317 ChannelHandshakeConfig_free(this_ptr_conv);
6320 uint32_t ChannelHandshakeConfig_1clone(void* ctx_TODO, uint32_t orig) {
6321 LDKChannelHandshakeConfig orig_conv;
6322 orig_conv.inner = (void*)(orig & (~1));
6323 orig_conv.is_owned = false;
6324 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
6325 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6326 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6327 long ret_ref = (long)ret_var.inner;
6328 if (ret_var.is_owned) {
6334 int32_t ChannelHandshakeConfig_1get_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
6335 LDKChannelHandshakeConfig this_ptr_conv;
6336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6337 this_ptr_conv.is_owned = false;
6338 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
6342 void ChannelHandshakeConfig_1set_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
6343 LDKChannelHandshakeConfig this_ptr_conv;
6344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6345 this_ptr_conv.is_owned = false;
6346 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
6349 int16_t ChannelHandshakeConfig_1get_1our_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
6350 LDKChannelHandshakeConfig this_ptr_conv;
6351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6352 this_ptr_conv.is_owned = false;
6353 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
6357 void ChannelHandshakeConfig_1set_1our_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
6358 LDKChannelHandshakeConfig this_ptr_conv;
6359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6360 this_ptr_conv.is_owned = false;
6361 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
6364 int64_t ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
6365 LDKChannelHandshakeConfig this_ptr_conv;
6366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6367 this_ptr_conv.is_owned = false;
6368 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
6372 void ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6373 LDKChannelHandshakeConfig this_ptr_conv;
6374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6375 this_ptr_conv.is_owned = false;
6376 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
6379 uint32_t ChannelHandshakeConfig_1new(void* ctx_TODO, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
6380 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
6381 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6382 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6383 long ret_ref = (long)ret_var.inner;
6384 if (ret_var.is_owned) {
6390 uint32_t ChannelHandshakeConfig_1default(void* ctx_TODO) {
6391 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
6392 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6393 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6394 long ret_ref = (long)ret_var.inner;
6395 if (ret_var.is_owned) {
6401 void ChannelHandshakeLimits_1free(void* ctx_TODO, uint32_t this_ptr) {
6402 LDKChannelHandshakeLimits this_ptr_conv;
6403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6405 ChannelHandshakeLimits_free(this_ptr_conv);
6408 uint32_t ChannelHandshakeLimits_1clone(void* ctx_TODO, uint32_t orig) {
6409 LDKChannelHandshakeLimits orig_conv;
6410 orig_conv.inner = (void*)(orig & (~1));
6411 orig_conv.is_owned = false;
6412 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
6413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6415 long ret_ref = (long)ret_var.inner;
6416 if (ret_var.is_owned) {
6422 int64_t ChannelHandshakeLimits_1get_1min_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6423 LDKChannelHandshakeLimits this_ptr_conv;
6424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6425 this_ptr_conv.is_owned = false;
6426 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
6430 void ChannelHandshakeLimits_1set_1min_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6431 LDKChannelHandshakeLimits this_ptr_conv;
6432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6433 this_ptr_conv.is_owned = false;
6434 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
6437 int64_t ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
6438 LDKChannelHandshakeLimits this_ptr_conv;
6439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6440 this_ptr_conv.is_owned = false;
6441 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
6445 void ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6446 LDKChannelHandshakeLimits this_ptr_conv;
6447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6448 this_ptr_conv.is_owned = false;
6449 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
6452 int64_t ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
6453 LDKChannelHandshakeLimits this_ptr_conv;
6454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6455 this_ptr_conv.is_owned = false;
6456 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
6460 void ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6461 LDKChannelHandshakeLimits this_ptr_conv;
6462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6463 this_ptr_conv.is_owned = false;
6464 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6467 int64_t ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6468 LDKChannelHandshakeLimits this_ptr_conv;
6469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6470 this_ptr_conv.is_owned = false;
6471 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
6475 void ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6476 LDKChannelHandshakeLimits this_ptr_conv;
6477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6478 this_ptr_conv.is_owned = false;
6479 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
6482 int16_t ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
6483 LDKChannelHandshakeLimits this_ptr_conv;
6484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6485 this_ptr_conv.is_owned = false;
6486 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
6490 void ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
6491 LDKChannelHandshakeLimits this_ptr_conv;
6492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6493 this_ptr_conv.is_owned = false;
6494 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
6497 int64_t ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6498 LDKChannelHandshakeLimits this_ptr_conv;
6499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6500 this_ptr_conv.is_owned = false;
6501 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
6505 void ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6506 LDKChannelHandshakeLimits this_ptr_conv;
6507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6508 this_ptr_conv.is_owned = false;
6509 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
6512 int64_t ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
6513 LDKChannelHandshakeLimits this_ptr_conv;
6514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6515 this_ptr_conv.is_owned = false;
6516 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
6520 void ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6521 LDKChannelHandshakeLimits this_ptr_conv;
6522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6523 this_ptr_conv.is_owned = false;
6524 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
6527 int32_t ChannelHandshakeLimits_1get_1max_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
6528 LDKChannelHandshakeLimits this_ptr_conv;
6529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6530 this_ptr_conv.is_owned = false;
6531 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
6535 void ChannelHandshakeLimits_1set_1max_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
6536 LDKChannelHandshakeLimits this_ptr_conv;
6537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6538 this_ptr_conv.is_owned = false;
6539 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
6542 jboolean ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(void* ctx_TODO, uint32_t this_ptr) {
6543 LDKChannelHandshakeLimits this_ptr_conv;
6544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6545 this_ptr_conv.is_owned = false;
6546 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
6550 void ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
6551 LDKChannelHandshakeLimits this_ptr_conv;
6552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6553 this_ptr_conv.is_owned = false;
6554 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
6557 int16_t ChannelHandshakeLimits_1get_1their_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
6558 LDKChannelHandshakeLimits this_ptr_conv;
6559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6560 this_ptr_conv.is_owned = false;
6561 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
6565 void ChannelHandshakeLimits_1set_1their_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
6566 LDKChannelHandshakeLimits this_ptr_conv;
6567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6568 this_ptr_conv.is_owned = false;
6569 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
6572 uint32_t ChannelHandshakeLimits_1new(void* ctx_TODO, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
6573 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
6574 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6575 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6576 long ret_ref = (long)ret_var.inner;
6577 if (ret_var.is_owned) {
6583 uint32_t ChannelHandshakeLimits_1default(void* ctx_TODO) {
6584 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
6585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6587 long ret_ref = (long)ret_var.inner;
6588 if (ret_var.is_owned) {
6594 void ChannelConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
6595 LDKChannelConfig this_ptr_conv;
6596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6598 ChannelConfig_free(this_ptr_conv);
6601 uint32_t ChannelConfig_1clone(void* ctx_TODO, uint32_t orig) {
6602 LDKChannelConfig orig_conv;
6603 orig_conv.inner = (void*)(orig & (~1));
6604 orig_conv.is_owned = false;
6605 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
6606 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6607 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6608 long ret_ref = (long)ret_var.inner;
6609 if (ret_var.is_owned) {
6615 int32_t ChannelConfig_1get_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
6616 LDKChannelConfig this_ptr_conv;
6617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6618 this_ptr_conv.is_owned = false;
6619 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
6623 void ChannelConfig_1set_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
6624 LDKChannelConfig this_ptr_conv;
6625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6626 this_ptr_conv.is_owned = false;
6627 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
6630 jboolean ChannelConfig_1get_1announced_1channel(void* ctx_TODO, uint32_t this_ptr) {
6631 LDKChannelConfig this_ptr_conv;
6632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6633 this_ptr_conv.is_owned = false;
6634 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
6638 void ChannelConfig_1set_1announced_1channel(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
6639 LDKChannelConfig this_ptr_conv;
6640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6641 this_ptr_conv.is_owned = false;
6642 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
6645 jboolean ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
6646 LDKChannelConfig this_ptr_conv;
6647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6648 this_ptr_conv.is_owned = false;
6649 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
6653 void ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
6654 LDKChannelConfig this_ptr_conv;
6655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6656 this_ptr_conv.is_owned = false;
6657 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
6660 uint32_t ChannelConfig_1new(void* ctx_TODO, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
6661 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
6662 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6663 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6664 long ret_ref = (long)ret_var.inner;
6665 if (ret_var.is_owned) {
6671 uint32_t ChannelConfig_1default(void* ctx_TODO) {
6672 LDKChannelConfig ret_var = ChannelConfig_default();
6673 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6674 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6675 long ret_ref = (long)ret_var.inner;
6676 if (ret_var.is_owned) {
6682 int8_tArray ChannelConfig_1write(void* ctx_TODO, uint32_t obj) {
6683 LDKChannelConfig obj_conv;
6684 obj_conv.inner = (void*)(obj & (~1));
6685 obj_conv.is_owned = false;
6686 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
6687 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
6688 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
6689 CVec_u8Z_free(arg_var);
6693 uint32_t ChannelConfig_1read(void* ctx_TODO, int8_tArray ser) {
6695 ser_ref.datalen = *ser.len;
6696 ser_ref.data = (int8_t*)(ser.len + 1);
6697 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
6698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6700 long ret_ref = (long)ret_var.inner;
6701 if (ret_var.is_owned) {
6707 void UserConfig_1free(void* ctx_TODO, uint32_t this_ptr) {
6708 LDKUserConfig this_ptr_conv;
6709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6710 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6711 UserConfig_free(this_ptr_conv);
6714 uint32_t UserConfig_1clone(void* ctx_TODO, uint32_t orig) {
6715 LDKUserConfig orig_conv;
6716 orig_conv.inner = (void*)(orig & (~1));
6717 orig_conv.is_owned = false;
6718 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6719 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6720 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6721 long ret_ref = (long)ret_var.inner;
6722 if (ret_var.is_owned) {
6728 uint32_t UserConfig_1get_1own_1channel_1config(void* ctx_TODO, uint32_t this_ptr) {
6729 LDKUserConfig this_ptr_conv;
6730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6731 this_ptr_conv.is_owned = false;
6732 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6733 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6734 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6735 long ret_ref = (long)ret_var.inner;
6736 if (ret_var.is_owned) {
6742 void UserConfig_1set_1own_1channel_1config(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6743 LDKUserConfig this_ptr_conv;
6744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6745 this_ptr_conv.is_owned = false;
6746 LDKChannelHandshakeConfig val_conv;
6747 val_conv.inner = (void*)(val & (~1));
6748 val_conv.is_owned = (val & 1) || (val == 0);
6749 if (val_conv.inner != NULL)
6750 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6751 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6754 uint32_t UserConfig_1get_1peer_1channel_1config_1limits(void* ctx_TODO, uint32_t this_ptr) {
6755 LDKUserConfig this_ptr_conv;
6756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6757 this_ptr_conv.is_owned = false;
6758 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
6759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6761 long ret_ref = (long)ret_var.inner;
6762 if (ret_var.is_owned) {
6768 void UserConfig_1set_1peer_1channel_1config_1limits(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6769 LDKUserConfig this_ptr_conv;
6770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6771 this_ptr_conv.is_owned = false;
6772 LDKChannelHandshakeLimits val_conv;
6773 val_conv.inner = (void*)(val & (~1));
6774 val_conv.is_owned = (val & 1) || (val == 0);
6775 if (val_conv.inner != NULL)
6776 val_conv = ChannelHandshakeLimits_clone(&val_conv);
6777 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6780 uint32_t UserConfig_1get_1channel_1options(void* ctx_TODO, uint32_t this_ptr) {
6781 LDKUserConfig this_ptr_conv;
6782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6783 this_ptr_conv.is_owned = false;
6784 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
6785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6787 long ret_ref = (long)ret_var.inner;
6788 if (ret_var.is_owned) {
6794 void UserConfig_1set_1channel_1options(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
6795 LDKUserConfig this_ptr_conv;
6796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6797 this_ptr_conv.is_owned = false;
6798 LDKChannelConfig val_conv;
6799 val_conv.inner = (void*)(val & (~1));
6800 val_conv.is_owned = (val & 1) || (val == 0);
6801 if (val_conv.inner != NULL)
6802 val_conv = ChannelConfig_clone(&val_conv);
6803 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6806 uint32_t UserConfig_1new(void* ctx_TODO, uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg) {
6807 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6808 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6809 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6810 if (own_channel_config_arg_conv.inner != NULL)
6811 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6812 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6813 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6814 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6815 if (peer_channel_config_limits_arg_conv.inner != NULL)
6816 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6817 LDKChannelConfig channel_options_arg_conv;
6818 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6819 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6820 if (channel_options_arg_conv.inner != NULL)
6821 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6822 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6823 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6824 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6825 long ret_ref = (long)ret_var.inner;
6826 if (ret_var.is_owned) {
6832 uint32_t UserConfig_1default(void* ctx_TODO) {
6833 LDKUserConfig ret_var = UserConfig_default();
6834 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6835 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6836 long ret_ref = (long)ret_var.inner;
6837 if (ret_var.is_owned) {
6843 uint32_t AccessError_1clone(void* ctx_TODO, uint32_t orig) {
6844 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6845 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
6849 void Access_1free(void* ctx_TODO, uint32_t this_ptr) {
6850 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6851 FREE((void*)this_ptr);
6852 Access_free(this_ptr_conv);
6855 void Watch_1free(void* ctx_TODO, uint32_t this_ptr) {
6856 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6857 FREE((void*)this_ptr);
6858 Watch_free(this_ptr_conv);
6861 void Filter_1free(void* ctx_TODO, uint32_t this_ptr) {
6862 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6863 FREE((void*)this_ptr);
6864 Filter_free(this_ptr_conv);
6867 void BroadcasterInterface_1free(void* ctx_TODO, uint32_t this_ptr) {
6868 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6869 FREE((void*)this_ptr);
6870 BroadcasterInterface_free(this_ptr_conv);
6873 uint32_t ConfirmationTarget_1clone(void* ctx_TODO, uint32_t orig) {
6874 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6875 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
6879 void FeeEstimator_1free(void* ctx_TODO, uint32_t this_ptr) {
6880 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6881 FREE((void*)this_ptr);
6882 FeeEstimator_free(this_ptr_conv);
6885 void ChainMonitor_1free(void* ctx_TODO, uint32_t this_ptr) {
6886 LDKChainMonitor this_ptr_conv;
6887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6889 ChainMonitor_free(this_ptr_conv);
6892 void ChainMonitor_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
6893 LDKChainMonitor this_arg_conv;
6894 this_arg_conv.inner = (void*)(this_arg & (~1));
6895 this_arg_conv.is_owned = false;
6896 unsigned char header_arr[80];
6897 CHECK(*header.len == 80);
6898 memcpy(header_arr, header.len + 1, 80);
6899 unsigned char (*header_ref)[80] = &header_arr;
6900 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6901 txdata_constr.datalen = *txdata.len;
6902 if (txdata_constr.datalen > 0)
6903 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6905 txdata_constr.data = NULL;
6906 uint32_t* txdata_vals = (uint32_t*)(txdata.len + 1);
6907 for (size_t e = 0; e < txdata_constr.datalen; e++) {
6908 uint32_t arr_conv_30 = txdata_vals[e];
6909 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
6910 FREE((void*)arr_conv_30);
6911 txdata_constr.data[e] = arr_conv_30_conv;
6913 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6916 void ChainMonitor_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
6917 LDKChainMonitor this_arg_conv;
6918 this_arg_conv.inner = (void*)(this_arg & (~1));
6919 this_arg_conv.is_owned = false;
6920 unsigned char header_arr[80];
6921 CHECK(*header.len == 80);
6922 memcpy(header_arr, header.len + 1, 80);
6923 unsigned char (*header_ref)[80] = &header_arr;
6924 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6927 uint32_t ChainMonitor_1new(void* ctx_TODO, uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
6928 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6929 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6930 LDKLogger logger_conv = *(LDKLogger*)logger;
6931 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6932 LDKPersist persister_conv = *(LDKPersist*)persister;
6933 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
6934 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6935 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6936 long ret_ref = (long)ret_var.inner;
6937 if (ret_var.is_owned) {
6943 uint32_t ChainMonitor_1as_1Watch(void* ctx_TODO, uint32_t this_arg) {
6944 LDKChainMonitor this_arg_conv;
6945 this_arg_conv.inner = (void*)(this_arg & (~1));
6946 this_arg_conv.is_owned = false;
6947 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6948 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6952 uint32_t ChainMonitor_1as_1EventsProvider(void* ctx_TODO, uint32_t this_arg) {
6953 LDKChainMonitor this_arg_conv;
6954 this_arg_conv.inner = (void*)(this_arg & (~1));
6955 this_arg_conv.is_owned = false;
6956 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6957 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6961 void ChannelMonitorUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
6962 LDKChannelMonitorUpdate this_ptr_conv;
6963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6965 ChannelMonitorUpdate_free(this_ptr_conv);
6968 uint32_t ChannelMonitorUpdate_1clone(void* ctx_TODO, uint32_t orig) {
6969 LDKChannelMonitorUpdate orig_conv;
6970 orig_conv.inner = (void*)(orig & (~1));
6971 orig_conv.is_owned = false;
6972 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6975 long ret_ref = (long)ret_var.inner;
6976 if (ret_var.is_owned) {
6982 int64_t ChannelMonitorUpdate_1get_1update_1id(void* ctx_TODO, uint32_t this_ptr) {
6983 LDKChannelMonitorUpdate this_ptr_conv;
6984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6985 this_ptr_conv.is_owned = false;
6986 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6990 void ChannelMonitorUpdate_1set_1update_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
6991 LDKChannelMonitorUpdate this_ptr_conv;
6992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6993 this_ptr_conv.is_owned = false;
6994 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6997 int8_tArray ChannelMonitorUpdate_1write(void* ctx_TODO, uint32_t obj) {
6998 LDKChannelMonitorUpdate obj_conv;
6999 obj_conv.inner = (void*)(obj & (~1));
7000 obj_conv.is_owned = false;
7001 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
7002 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
7003 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
7004 CVec_u8Z_free(arg_var);
7008 uint32_t ChannelMonitorUpdate_1read(void* ctx_TODO, int8_tArray ser) {
7010 ser_ref.datalen = *ser.len;
7011 ser_ref.data = (int8_t*)(ser.len + 1);
7012 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
7013 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
7014 return (long)ret_conv;
7017 uint32_t ChannelMonitorUpdateErr_1clone(void* ctx_TODO, uint32_t orig) {
7018 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
7019 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
7023 void MonitorUpdateError_1free(void* ctx_TODO, uint32_t this_ptr) {
7024 LDKMonitorUpdateError this_ptr_conv;
7025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7027 MonitorUpdateError_free(this_ptr_conv);
7030 void MonitorEvent_1free(void* ctx_TODO, uint32_t this_ptr) {
7031 LDKMonitorEvent this_ptr_conv;
7032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7034 MonitorEvent_free(this_ptr_conv);
7037 uint32_t MonitorEvent_1clone(void* ctx_TODO, uint32_t orig) {
7038 LDKMonitorEvent orig_conv;
7039 orig_conv.inner = (void*)(orig & (~1));
7040 orig_conv.is_owned = false;
7041 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
7042 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7043 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7044 long ret_ref = (long)ret_var.inner;
7045 if (ret_var.is_owned) {
7051 void HTLCUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
7052 LDKHTLCUpdate this_ptr_conv;
7053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7055 HTLCUpdate_free(this_ptr_conv);
7058 uint32_t HTLCUpdate_1clone(void* ctx_TODO, uint32_t orig) {
7059 LDKHTLCUpdate orig_conv;
7060 orig_conv.inner = (void*)(orig & (~1));
7061 orig_conv.is_owned = false;
7062 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
7063 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7064 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7065 long ret_ref = (long)ret_var.inner;
7066 if (ret_var.is_owned) {
7072 int8_tArray HTLCUpdate_1write(void* ctx_TODO, uint32_t obj) {
7073 LDKHTLCUpdate obj_conv;
7074 obj_conv.inner = (void*)(obj & (~1));
7075 obj_conv.is_owned = false;
7076 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
7077 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
7078 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
7079 CVec_u8Z_free(arg_var);
7083 uint32_t HTLCUpdate_1read(void* ctx_TODO, int8_tArray ser) {
7085 ser_ref.datalen = *ser.len;
7086 ser_ref.data = (int8_t*)(ser.len + 1);
7087 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
7088 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7089 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7090 long ret_ref = (long)ret_var.inner;
7091 if (ret_var.is_owned) {
7097 void ChannelMonitor_1free(void* ctx_TODO, uint32_t this_ptr) {
7098 LDKChannelMonitor this_ptr_conv;
7099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7101 ChannelMonitor_free(this_ptr_conv);
7104 int8_tArray ChannelMonitor_1write(void* ctx_TODO, uint32_t obj) {
7105 LDKChannelMonitor obj_conv;
7106 obj_conv.inner = (void*)(obj & (~1));
7107 obj_conv.is_owned = false;
7108 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
7109 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
7110 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
7111 CVec_u8Z_free(arg_var);
7115 uint32_t ChannelMonitor_1update_1monitor(void* ctx_TODO, uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
7116 LDKChannelMonitor this_arg_conv;
7117 this_arg_conv.inner = (void*)(this_arg & (~1));
7118 this_arg_conv.is_owned = false;
7119 LDKChannelMonitorUpdate updates_conv;
7120 updates_conv.inner = (void*)(updates & (~1));
7121 updates_conv.is_owned = false;
7122 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
7123 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
7124 LDKLogger* logger_conv = (LDKLogger*)logger;
7125 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
7126 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
7127 return (long)ret_conv;
7130 int64_t ChannelMonitor_1get_1latest_1update_1id(void* ctx_TODO, uint32_t this_arg) {
7131 LDKChannelMonitor this_arg_conv;
7132 this_arg_conv.inner = (void*)(this_arg & (~1));
7133 this_arg_conv.is_owned = false;
7134 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
7138 uint32_t ChannelMonitor_1get_1funding_1txo(void* ctx_TODO, uint32_t this_arg) {
7139 LDKChannelMonitor this_arg_conv;
7140 this_arg_conv.inner = (void*)(this_arg & (~1));
7141 this_arg_conv.is_owned = false;
7142 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
7143 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
7144 ret_ref->a = OutPoint_clone(&ret_ref->a);
7145 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
7146 return (long)ret_ref;
7149 uint32_tArray ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(void* ctx_TODO, uint32_t this_arg) {
7150 LDKChannelMonitor this_arg_conv;
7151 this_arg_conv.inner = (void*)(this_arg & (~1));
7152 this_arg_conv.is_owned = false;
7153 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
7154 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
7155 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
7156 for (size_t o = 0; o < ret_var.datalen; o++) {
7157 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
7158 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7159 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7160 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
7161 if (arr_conv_14_var.is_owned) {
7162 arr_conv_14_ref |= 1;
7164 ret_arr_ptr[o] = arr_conv_14_ref;
7170 uint32_tArray ChannelMonitor_1get_1and_1clear_1pending_1events(void* ctx_TODO, uint32_t this_arg) {
7171 LDKChannelMonitor this_arg_conv;
7172 this_arg_conv.inner = (void*)(this_arg & (~1));
7173 this_arg_conv.is_owned = false;
7174 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
7175 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
7176 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
7177 for (size_t h = 0; h < ret_var.datalen; h++) {
7178 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
7179 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
7180 long arr_conv_7_ref = (long)arr_conv_7_copy;
7181 ret_arr_ptr[h] = arr_conv_7_ref;
7187 ptrArray ChannelMonitor_1get_1latest_1holder_1commitment_1txn(void* ctx_TODO, uint32_t this_arg, uint32_t logger) {
7188 LDKChannelMonitor this_arg_conv;
7189 this_arg_conv.inner = (void*)(this_arg & (~1));
7190 this_arg_conv.is_owned = false;
7191 LDKLogger* logger_conv = (LDKLogger*)logger;
7192 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
7193 ptrArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
7194 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr.len + 1);
7195 for (size_t m = 0; m < ret_var.datalen; m++) {
7196 LDKTransaction arr_conv_12_var = ret_var.data[m];
7197 int8_tArray arr_conv_12_arr = { .len = MALLOC(arr_conv_12_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
7198 memcpy(arr_conv_12_arr.len + 1, arr_conv_12_var.data, arr_conv_12_var.datalen);
7199 Transaction_free(arr_conv_12_var);
7200 ret_arr_ptr[m] = arr_conv_12_arr;
7206 uint32_tArray ChannelMonitor_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
7207 LDKChannelMonitor this_arg_conv;
7208 this_arg_conv.inner = (void*)(this_arg & (~1));
7209 this_arg_conv.is_owned = false;
7210 unsigned char header_arr[80];
7211 CHECK(*header.len == 80);
7212 memcpy(header_arr, header.len + 1, 80);
7213 unsigned char (*header_ref)[80] = &header_arr;
7214 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7215 txdata_constr.datalen = *txdata.len;
7216 if (txdata_constr.datalen > 0)
7217 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7219 txdata_constr.data = NULL;
7220 uint32_t* txdata_vals = (uint32_t*)(txdata.len + 1);
7221 for (size_t e = 0; e < txdata_constr.datalen; e++) {
7222 uint32_t arr_conv_30 = txdata_vals[e];
7223 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
7224 FREE((void*)arr_conv_30);
7225 txdata_constr.data[e] = arr_conv_30_conv;
7227 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
7228 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7229 LDKLogger logger_conv = *(LDKLogger*)logger;
7230 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
7231 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
7232 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
7233 for (size_t x = 0; x < ret_var.datalen; x++) {
7234 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
7235 *arr_conv_49_ref = ret_var.data[x];
7236 arr_conv_49_ref->a = ThirtyTwoBytes_clone(&arr_conv_49_ref->a);
7237 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Number, TxOut>[]
7238 ret_arr_ptr[x] = (long)arr_conv_49_ref;
7244 void ChannelMonitor_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
7245 LDKChannelMonitor this_arg_conv;
7246 this_arg_conv.inner = (void*)(this_arg & (~1));
7247 this_arg_conv.is_owned = false;
7248 unsigned char header_arr[80];
7249 CHECK(*header.len == 80);
7250 memcpy(header_arr, header.len + 1, 80);
7251 unsigned char (*header_ref)[80] = &header_arr;
7252 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
7253 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7254 LDKLogger logger_conv = *(LDKLogger*)logger;
7255 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
7258 void Persist_1free(void* ctx_TODO, uint32_t this_ptr) {
7259 LDKPersist this_ptr_conv = *(LDKPersist*)this_ptr;
7260 FREE((void*)this_ptr);
7261 Persist_free(this_ptr_conv);
7264 uint32_t C2Tuple_1BlockHashChannelMonitorZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
7266 ser_ref.datalen = *ser.len;
7267 ser_ref.data = (int8_t*)(ser.len + 1);
7268 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
7269 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7270 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
7271 return (long)ret_conv;
7274 void OutPoint_1free(void* ctx_TODO, uint32_t this_ptr) {
7275 LDKOutPoint this_ptr_conv;
7276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7278 OutPoint_free(this_ptr_conv);
7281 uint32_t OutPoint_1clone(void* ctx_TODO, uint32_t orig) {
7282 LDKOutPoint orig_conv;
7283 orig_conv.inner = (void*)(orig & (~1));
7284 orig_conv.is_owned = false;
7285 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
7286 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7287 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7288 long ret_ref = (long)ret_var.inner;
7289 if (ret_var.is_owned) {
7295 int8_tArray OutPoint_1get_1txid(void* ctx_TODO, uint32_t this_ptr) {
7296 LDKOutPoint this_ptr_conv;
7297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7298 this_ptr_conv.is_owned = false;
7299 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7300 memcpy(ret_arr.len + 1, *OutPoint_get_txid(&this_ptr_conv), 32);
7304 void OutPoint_1set_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7305 LDKOutPoint this_ptr_conv;
7306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7307 this_ptr_conv.is_owned = false;
7308 LDKThirtyTwoBytes val_ref;
7309 CHECK(*val.len == 32);
7310 memcpy(val_ref.data, val.len + 1, 32);
7311 OutPoint_set_txid(&this_ptr_conv, val_ref);
7314 int16_t OutPoint_1get_1index(void* ctx_TODO, uint32_t this_ptr) {
7315 LDKOutPoint this_ptr_conv;
7316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7317 this_ptr_conv.is_owned = false;
7318 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
7322 void OutPoint_1set_1index(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
7323 LDKOutPoint this_ptr_conv;
7324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7325 this_ptr_conv.is_owned = false;
7326 OutPoint_set_index(&this_ptr_conv, val);
7329 uint32_t OutPoint_1new(void* ctx_TODO, int8_tArray txid_arg, int16_t index_arg) {
7330 LDKThirtyTwoBytes txid_arg_ref;
7331 CHECK(*txid_arg.len == 32);
7332 memcpy(txid_arg_ref.data, txid_arg.len + 1, 32);
7333 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
7334 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7335 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7336 long ret_ref = (long)ret_var.inner;
7337 if (ret_var.is_owned) {
7343 int8_tArray OutPoint_1to_1channel_1id(void* ctx_TODO, uint32_t this_arg) {
7344 LDKOutPoint this_arg_conv;
7345 this_arg_conv.inner = (void*)(this_arg & (~1));
7346 this_arg_conv.is_owned = false;
7347 int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7348 memcpy(arg_arr.len + 1, OutPoint_to_channel_id(&this_arg_conv).data, 32);
7352 int8_tArray OutPoint_1write(void* ctx_TODO, uint32_t obj) {
7353 LDKOutPoint obj_conv;
7354 obj_conv.inner = (void*)(obj & (~1));
7355 obj_conv.is_owned = false;
7356 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
7357 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
7358 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
7359 CVec_u8Z_free(arg_var);
7363 uint32_t OutPoint_1read(void* ctx_TODO, int8_tArray ser) {
7365 ser_ref.datalen = *ser.len;
7366 ser_ref.data = (int8_t*)(ser.len + 1);
7367 LDKOutPoint ret_var = OutPoint_read(ser_ref);
7368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7370 long ret_ref = (long)ret_var.inner;
7371 if (ret_var.is_owned) {
7377 void SpendableOutputDescriptor_1free(void* ctx_TODO, uint32_t this_ptr) {
7378 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
7379 FREE((void*)this_ptr);
7380 SpendableOutputDescriptor_free(this_ptr_conv);
7383 uint32_t SpendableOutputDescriptor_1clone(void* ctx_TODO, uint32_t orig) {
7384 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
7385 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
7386 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
7387 long ret_ref = (long)ret_copy;
7391 int8_tArray SpendableOutputDescriptor_1write(void* ctx_TODO, uint32_t obj) {
7392 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
7393 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
7394 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
7395 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
7396 CVec_u8Z_free(arg_var);
7400 uint32_t SpendableOutputDescriptor_1read(void* ctx_TODO, int8_tArray ser) {
7402 ser_ref.datalen = *ser.len;
7403 ser_ref.data = (int8_t*)(ser.len + 1);
7404 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7405 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
7406 return (long)ret_conv;
7409 uint32_t ChannelKeys_1clone(void* ctx_TODO, uint32_t orig) {
7410 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
7411 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
7412 *ret = ChannelKeys_clone(orig_conv);
7416 void ChannelKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
7417 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
7418 FREE((void*)this_ptr);
7419 ChannelKeys_free(this_ptr_conv);
7422 void KeysInterface_1free(void* ctx_TODO, uint32_t this_ptr) {
7423 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
7424 FREE((void*)this_ptr);
7425 KeysInterface_free(this_ptr_conv);
7428 void InMemoryChannelKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
7429 LDKInMemoryChannelKeys this_ptr_conv;
7430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7432 InMemoryChannelKeys_free(this_ptr_conv);
7435 uint32_t InMemoryChannelKeys_1clone(void* ctx_TODO, uint32_t orig) {
7436 LDKInMemoryChannelKeys orig_conv;
7437 orig_conv.inner = (void*)(orig & (~1));
7438 orig_conv.is_owned = false;
7439 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
7440 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7441 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7442 long ret_ref = (long)ret_var.inner;
7443 if (ret_var.is_owned) {
7449 int8_tArray InMemoryChannelKeys_1get_1funding_1key(void* ctx_TODO, uint32_t this_ptr) {
7450 LDKInMemoryChannelKeys this_ptr_conv;
7451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7452 this_ptr_conv.is_owned = false;
7453 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7454 memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv), 32);
7458 void InMemoryChannelKeys_1set_1funding_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7459 LDKInMemoryChannelKeys this_ptr_conv;
7460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7461 this_ptr_conv.is_owned = false;
7462 LDKSecretKey val_ref;
7463 CHECK(*val.len == 32);
7464 memcpy(val_ref.bytes, val.len + 1, 32);
7465 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
7468 int8_tArray InMemoryChannelKeys_1get_1revocation_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
7469 LDKInMemoryChannelKeys this_ptr_conv;
7470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7471 this_ptr_conv.is_owned = false;
7472 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7473 memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv), 32);
7477 void InMemoryChannelKeys_1set_1revocation_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7478 LDKInMemoryChannelKeys this_ptr_conv;
7479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7480 this_ptr_conv.is_owned = false;
7481 LDKSecretKey val_ref;
7482 CHECK(*val.len == 32);
7483 memcpy(val_ref.bytes, val.len + 1, 32);
7484 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
7487 int8_tArray InMemoryChannelKeys_1get_1payment_1key(void* ctx_TODO, uint32_t this_ptr) {
7488 LDKInMemoryChannelKeys this_ptr_conv;
7489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7490 this_ptr_conv.is_owned = false;
7491 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7492 memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv), 32);
7496 void InMemoryChannelKeys_1set_1payment_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7497 LDKInMemoryChannelKeys this_ptr_conv;
7498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7499 this_ptr_conv.is_owned = false;
7500 LDKSecretKey val_ref;
7501 CHECK(*val.len == 32);
7502 memcpy(val_ref.bytes, val.len + 1, 32);
7503 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
7506 int8_tArray InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
7507 LDKInMemoryChannelKeys this_ptr_conv;
7508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7509 this_ptr_conv.is_owned = false;
7510 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7511 memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv), 32);
7515 void InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7516 LDKInMemoryChannelKeys this_ptr_conv;
7517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7518 this_ptr_conv.is_owned = false;
7519 LDKSecretKey val_ref;
7520 CHECK(*val.len == 32);
7521 memcpy(val_ref.bytes, val.len + 1, 32);
7522 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
7525 int8_tArray InMemoryChannelKeys_1get_1htlc_1base_1key(void* ctx_TODO, uint32_t this_ptr) {
7526 LDKInMemoryChannelKeys this_ptr_conv;
7527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7528 this_ptr_conv.is_owned = false;
7529 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7530 memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv), 32);
7534 void InMemoryChannelKeys_1set_1htlc_1base_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7535 LDKInMemoryChannelKeys this_ptr_conv;
7536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7537 this_ptr_conv.is_owned = false;
7538 LDKSecretKey val_ref;
7539 CHECK(*val.len == 32);
7540 memcpy(val_ref.bytes, val.len + 1, 32);
7541 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
7544 int8_tArray InMemoryChannelKeys_1get_1commitment_1seed(void* ctx_TODO, uint32_t this_ptr) {
7545 LDKInMemoryChannelKeys this_ptr_conv;
7546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7547 this_ptr_conv.is_owned = false;
7548 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7549 memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv), 32);
7553 void InMemoryChannelKeys_1set_1commitment_1seed(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7554 LDKInMemoryChannelKeys this_ptr_conv;
7555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7556 this_ptr_conv.is_owned = false;
7557 LDKThirtyTwoBytes val_ref;
7558 CHECK(*val.len == 32);
7559 memcpy(val_ref.data, val.len + 1, 32);
7560 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
7563 uint32_t InMemoryChannelKeys_1new(void* ctx_TODO, 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, uint32_t key_derivation_params) {
7564 LDKSecretKey funding_key_ref;
7565 CHECK(*funding_key.len == 32);
7566 memcpy(funding_key_ref.bytes, funding_key.len + 1, 32);
7567 LDKSecretKey revocation_base_key_ref;
7568 CHECK(*revocation_base_key.len == 32);
7569 memcpy(revocation_base_key_ref.bytes, revocation_base_key.len + 1, 32);
7570 LDKSecretKey payment_key_ref;
7571 CHECK(*payment_key.len == 32);
7572 memcpy(payment_key_ref.bytes, payment_key.len + 1, 32);
7573 LDKSecretKey delayed_payment_base_key_ref;
7574 CHECK(*delayed_payment_base_key.len == 32);
7575 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key.len + 1, 32);
7576 LDKSecretKey htlc_base_key_ref;
7577 CHECK(*htlc_base_key.len == 32);
7578 memcpy(htlc_base_key_ref.bytes, htlc_base_key.len + 1, 32);
7579 LDKThirtyTwoBytes commitment_seed_ref;
7580 CHECK(*commitment_seed.len == 32);
7581 memcpy(commitment_seed_ref.data, commitment_seed.len + 1, 32);
7582 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
7583 FREE((void*)key_derivation_params);
7584 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
7585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7587 long ret_ref = (long)ret_var.inner;
7588 if (ret_var.is_owned) {
7594 uint32_t InMemoryChannelKeys_1counterparty_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
7595 LDKInMemoryChannelKeys this_arg_conv;
7596 this_arg_conv.inner = (void*)(this_arg & (~1));
7597 this_arg_conv.is_owned = false;
7598 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
7599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7601 long ret_ref = (long)ret_var.inner;
7602 if (ret_var.is_owned) {
7608 int16_t InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
7609 LDKInMemoryChannelKeys this_arg_conv;
7610 this_arg_conv.inner = (void*)(this_arg & (~1));
7611 this_arg_conv.is_owned = false;
7612 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
7616 int16_t InMemoryChannelKeys_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
7617 LDKInMemoryChannelKeys this_arg_conv;
7618 this_arg_conv.inner = (void*)(this_arg & (~1));
7619 this_arg_conv.is_owned = false;
7620 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
7624 jboolean InMemoryChannelKeys_1is_1outbound(void* ctx_TODO, uint32_t this_arg) {
7625 LDKInMemoryChannelKeys this_arg_conv;
7626 this_arg_conv.inner = (void*)(this_arg & (~1));
7627 this_arg_conv.is_owned = false;
7628 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
7632 uint32_t InMemoryChannelKeys_1funding_1outpoint(void* ctx_TODO, uint32_t this_arg) {
7633 LDKInMemoryChannelKeys this_arg_conv;
7634 this_arg_conv.inner = (void*)(this_arg & (~1));
7635 this_arg_conv.is_owned = false;
7636 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
7637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7639 long ret_ref = (long)ret_var.inner;
7640 if (ret_var.is_owned) {
7646 uint32_t InMemoryChannelKeys_1get_1channel_1parameters(void* ctx_TODO, uint32_t this_arg) {
7647 LDKInMemoryChannelKeys this_arg_conv;
7648 this_arg_conv.inner = (void*)(this_arg & (~1));
7649 this_arg_conv.is_owned = false;
7650 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
7651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7653 long ret_ref = (long)ret_var.inner;
7654 if (ret_var.is_owned) {
7660 uint32_t InMemoryChannelKeys_1as_1ChannelKeys(void* ctx_TODO, uint32_t this_arg) {
7661 LDKInMemoryChannelKeys this_arg_conv;
7662 this_arg_conv.inner = (void*)(this_arg & (~1));
7663 this_arg_conv.is_owned = false;
7664 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
7665 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
7669 int8_tArray InMemoryChannelKeys_1write(void* ctx_TODO, uint32_t obj) {
7670 LDKInMemoryChannelKeys obj_conv;
7671 obj_conv.inner = (void*)(obj & (~1));
7672 obj_conv.is_owned = false;
7673 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
7674 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
7675 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
7676 CVec_u8Z_free(arg_var);
7680 uint32_t InMemoryChannelKeys_1read(void* ctx_TODO, int8_tArray ser) {
7682 ser_ref.datalen = *ser.len;
7683 ser_ref.data = (int8_t*)(ser.len + 1);
7684 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
7685 *ret_conv = InMemoryChannelKeys_read(ser_ref);
7686 return (long)ret_conv;
7689 void KeysManager_1free(void* ctx_TODO, uint32_t this_ptr) {
7690 LDKKeysManager this_ptr_conv;
7691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7693 KeysManager_free(this_ptr_conv);
7696 uint32_t KeysManager_1new(void* ctx_TODO, int8_tArray seed, uint32_t network, int64_t starting_time_secs, int32_t starting_time_nanos) {
7697 unsigned char seed_arr[32];
7698 CHECK(*seed.len == 32);
7699 memcpy(seed_arr, seed.len + 1, 32);
7700 unsigned char (*seed_ref)[32] = &seed_arr;
7701 LDKNetwork network_conv = LDKNetwork_from_js(network);
7702 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
7703 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7704 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7705 long ret_ref = (long)ret_var.inner;
7706 if (ret_var.is_owned) {
7712 uint32_t KeysManager_1derive_1channel_1keys(void* ctx_TODO, uint32_t this_arg, int64_t channel_value_satoshis, int64_t params_1, int64_t params_2) {
7713 LDKKeysManager this_arg_conv;
7714 this_arg_conv.inner = (void*)(this_arg & (~1));
7715 this_arg_conv.is_owned = false;
7716 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
7717 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7718 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7719 long ret_ref = (long)ret_var.inner;
7720 if (ret_var.is_owned) {
7726 uint32_t KeysManager_1as_1KeysInterface(void* ctx_TODO, uint32_t this_arg) {
7727 LDKKeysManager this_arg_conv;
7728 this_arg_conv.inner = (void*)(this_arg & (~1));
7729 this_arg_conv.is_owned = false;
7730 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7731 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
7735 void ChannelManager_1free(void* ctx_TODO, uint32_t this_ptr) {
7736 LDKChannelManager this_ptr_conv;
7737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7739 ChannelManager_free(this_ptr_conv);
7742 void ChannelDetails_1free(void* ctx_TODO, uint32_t this_ptr) {
7743 LDKChannelDetails this_ptr_conv;
7744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7746 ChannelDetails_free(this_ptr_conv);
7749 uint32_t ChannelDetails_1clone(void* ctx_TODO, uint32_t orig) {
7750 LDKChannelDetails orig_conv;
7751 orig_conv.inner = (void*)(orig & (~1));
7752 orig_conv.is_owned = false;
7753 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
7754 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7755 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7756 long ret_ref = (long)ret_var.inner;
7757 if (ret_var.is_owned) {
7763 int8_tArray ChannelDetails_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
7764 LDKChannelDetails this_ptr_conv;
7765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7766 this_ptr_conv.is_owned = false;
7767 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7768 memcpy(ret_arr.len + 1, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
7772 void ChannelDetails_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7773 LDKChannelDetails this_ptr_conv;
7774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7775 this_ptr_conv.is_owned = false;
7776 LDKThirtyTwoBytes val_ref;
7777 CHECK(*val.len == 32);
7778 memcpy(val_ref.data, val.len + 1, 32);
7779 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7782 int8_tArray ChannelDetails_1get_1remote_1network_1id(void* ctx_TODO, uint32_t this_ptr) {
7783 LDKChannelDetails this_ptr_conv;
7784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7785 this_ptr_conv.is_owned = false;
7786 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
7787 memcpy(arg_arr.len + 1, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
7791 void ChannelDetails_1set_1remote_1network_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
7792 LDKChannelDetails this_ptr_conv;
7793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7794 this_ptr_conv.is_owned = false;
7795 LDKPublicKey val_ref;
7796 CHECK(*val.len == 33);
7797 memcpy(val_ref.compressed_form, val.len + 1, 33);
7798 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7801 uint32_t ChannelDetails_1get_1counterparty_1features(void* ctx_TODO, uint32_t this_ptr) {
7802 LDKChannelDetails this_ptr_conv;
7803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7804 this_ptr_conv.is_owned = false;
7805 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7806 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7807 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7808 long ret_ref = (long)ret_var.inner;
7809 if (ret_var.is_owned) {
7815 void ChannelDetails_1set_1counterparty_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
7816 LDKChannelDetails this_ptr_conv;
7817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7818 this_ptr_conv.is_owned = false;
7819 LDKInitFeatures val_conv;
7820 val_conv.inner = (void*)(val & (~1));
7821 val_conv.is_owned = (val & 1) || (val == 0);
7822 // Warning: we may need a move here but can't clone!
7823 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7826 int64_t ChannelDetails_1get_1channel_1value_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
7827 LDKChannelDetails this_ptr_conv;
7828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7829 this_ptr_conv.is_owned = false;
7830 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7834 void ChannelDetails_1set_1channel_1value_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7835 LDKChannelDetails this_ptr_conv;
7836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7837 this_ptr_conv.is_owned = false;
7838 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7841 int64_t ChannelDetails_1get_1user_1id(void* ctx_TODO, uint32_t this_ptr) {
7842 LDKChannelDetails this_ptr_conv;
7843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7844 this_ptr_conv.is_owned = false;
7845 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7849 void ChannelDetails_1set_1user_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7850 LDKChannelDetails this_ptr_conv;
7851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7852 this_ptr_conv.is_owned = false;
7853 ChannelDetails_set_user_id(&this_ptr_conv, val);
7856 int64_t ChannelDetails_1get_1outbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr) {
7857 LDKChannelDetails this_ptr_conv;
7858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7859 this_ptr_conv.is_owned = false;
7860 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7864 void ChannelDetails_1set_1outbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7865 LDKChannelDetails this_ptr_conv;
7866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7867 this_ptr_conv.is_owned = false;
7868 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7871 int64_t ChannelDetails_1get_1inbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr) {
7872 LDKChannelDetails this_ptr_conv;
7873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7874 this_ptr_conv.is_owned = false;
7875 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7879 void ChannelDetails_1set_1inbound_1capacity_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
7880 LDKChannelDetails this_ptr_conv;
7881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7882 this_ptr_conv.is_owned = false;
7883 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7886 jboolean ChannelDetails_1get_1is_1live(void* ctx_TODO, uint32_t this_ptr) {
7887 LDKChannelDetails this_ptr_conv;
7888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7889 this_ptr_conv.is_owned = false;
7890 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7894 void ChannelDetails_1set_1is_1live(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
7895 LDKChannelDetails this_ptr_conv;
7896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7897 this_ptr_conv.is_owned = false;
7898 ChannelDetails_set_is_live(&this_ptr_conv, val);
7901 void PaymentSendFailure_1free(void* ctx_TODO, uint32_t this_ptr) {
7902 LDKPaymentSendFailure this_ptr_conv;
7903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7905 PaymentSendFailure_free(this_ptr_conv);
7908 uint32_t ChannelManager_1new(void* ctx_TODO, uint32_t network, uint32_t fee_est, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t keys_manager, uint32_t config, intptr_t current_blockchain_height) {
7909 LDKNetwork network_conv = LDKNetwork_from_js(network);
7910 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7911 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7912 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7913 LDKLogger logger_conv = *(LDKLogger*)logger;
7914 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7915 LDKUserConfig config_conv;
7916 config_conv.inner = (void*)(config & (~1));
7917 config_conv.is_owned = (config & 1) || (config == 0);
7918 if (config_conv.inner != NULL)
7919 config_conv = UserConfig_clone(&config_conv);
7920 LDKChannelManager ret_var = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
7921 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7922 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7923 long ret_ref = (long)ret_var.inner;
7924 if (ret_var.is_owned) {
7930 uint32_t ChannelManager_1create_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, uint32_t override_config) {
7931 LDKChannelManager this_arg_conv;
7932 this_arg_conv.inner = (void*)(this_arg & (~1));
7933 this_arg_conv.is_owned = false;
7934 LDKPublicKey their_network_key_ref;
7935 CHECK(*their_network_key.len == 33);
7936 memcpy(their_network_key_ref.compressed_form, their_network_key.len + 1, 33);
7937 LDKUserConfig override_config_conv;
7938 override_config_conv.inner = (void*)(override_config & (~1));
7939 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7940 if (override_config_conv.inner != NULL)
7941 override_config_conv = UserConfig_clone(&override_config_conv);
7942 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7943 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7944 return (long)ret_conv;
7947 uint32_tArray ChannelManager_1list_1channels(void* ctx_TODO, uint32_t this_arg) {
7948 LDKChannelManager this_arg_conv;
7949 this_arg_conv.inner = (void*)(this_arg & (~1));
7950 this_arg_conv.is_owned = false;
7951 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7952 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
7953 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
7954 for (size_t q = 0; q < ret_var.datalen; q++) {
7955 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7956 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7957 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7958 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7959 if (arr_conv_16_var.is_owned) {
7960 arr_conv_16_ref |= 1;
7962 ret_arr_ptr[q] = arr_conv_16_ref;
7968 uint32_tArray ChannelManager_1list_1usable_1channels(void* ctx_TODO, uint32_t this_arg) {
7969 LDKChannelManager this_arg_conv;
7970 this_arg_conv.inner = (void*)(this_arg & (~1));
7971 this_arg_conv.is_owned = false;
7972 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7973 uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
7974 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
7975 for (size_t q = 0; q < ret_var.datalen; q++) {
7976 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7977 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7978 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7979 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7980 if (arr_conv_16_var.is_owned) {
7981 arr_conv_16_ref |= 1;
7983 ret_arr_ptr[q] = arr_conv_16_ref;
7989 uint32_t ChannelManager_1close_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray channel_id) {
7990 LDKChannelManager this_arg_conv;
7991 this_arg_conv.inner = (void*)(this_arg & (~1));
7992 this_arg_conv.is_owned = false;
7993 unsigned char channel_id_arr[32];
7994 CHECK(*channel_id.len == 32);
7995 memcpy(channel_id_arr, channel_id.len + 1, 32);
7996 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7997 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7998 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7999 return (long)ret_conv;
8002 void ChannelManager_1force_1close_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray channel_id) {
8003 LDKChannelManager this_arg_conv;
8004 this_arg_conv.inner = (void*)(this_arg & (~1));
8005 this_arg_conv.is_owned = false;
8006 unsigned char channel_id_arr[32];
8007 CHECK(*channel_id.len == 32);
8008 memcpy(channel_id_arr, channel_id.len + 1, 32);
8009 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
8010 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
8013 void ChannelManager_1force_1close_1all_1channels(void* ctx_TODO, uint32_t this_arg) {
8014 LDKChannelManager this_arg_conv;
8015 this_arg_conv.inner = (void*)(this_arg & (~1));
8016 this_arg_conv.is_owned = false;
8017 ChannelManager_force_close_all_channels(&this_arg_conv);
8020 uint32_t ChannelManager_1send_1payment(void* ctx_TODO, uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
8021 LDKChannelManager this_arg_conv;
8022 this_arg_conv.inner = (void*)(this_arg & (~1));
8023 this_arg_conv.is_owned = false;
8024 LDKRoute route_conv;
8025 route_conv.inner = (void*)(route & (~1));
8026 route_conv.is_owned = false;
8027 LDKThirtyTwoBytes payment_hash_ref;
8028 CHECK(*payment_hash.len == 32);
8029 memcpy(payment_hash_ref.data, payment_hash.len + 1, 32);
8030 LDKThirtyTwoBytes payment_secret_ref;
8031 CHECK(*payment_secret.len == 32);
8032 memcpy(payment_secret_ref.data, payment_secret.len + 1, 32);
8033 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
8034 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
8035 return (long)ret_conv;
8038 void ChannelManager_1funding_1transaction_1generated(void* ctx_TODO, uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
8039 LDKChannelManager this_arg_conv;
8040 this_arg_conv.inner = (void*)(this_arg & (~1));
8041 this_arg_conv.is_owned = false;
8042 unsigned char temporary_channel_id_arr[32];
8043 CHECK(*temporary_channel_id.len == 32);
8044 memcpy(temporary_channel_id_arr, temporary_channel_id.len + 1, 32);
8045 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
8046 LDKOutPoint funding_txo_conv;
8047 funding_txo_conv.inner = (void*)(funding_txo & (~1));
8048 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
8049 if (funding_txo_conv.inner != NULL)
8050 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
8051 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
8054 void ChannelManager_1broadcast_1node_1announcement(void* ctx_TODO, uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
8055 LDKChannelManager this_arg_conv;
8056 this_arg_conv.inner = (void*)(this_arg & (~1));
8057 this_arg_conv.is_owned = false;
8058 LDKThreeBytes rgb_ref;
8059 CHECK(*rgb.len == 3);
8060 memcpy(rgb_ref.data, rgb.len + 1, 3);
8061 LDKThirtyTwoBytes alias_ref;
8062 CHECK(*alias.len == 32);
8063 memcpy(alias_ref.data, alias.len + 1, 32);
8064 LDKCVec_NetAddressZ addresses_constr;
8065 addresses_constr.datalen = *addresses.len;
8066 if (addresses_constr.datalen > 0)
8067 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
8069 addresses_constr.data = NULL;
8070 uint32_t* addresses_vals = (uint32_t*)(addresses.len + 1);
8071 for (size_t m = 0; m < addresses_constr.datalen; m++) {
8072 uint32_t arr_conv_12 = addresses_vals[m];
8073 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
8074 FREE((void*)arr_conv_12);
8075 addresses_constr.data[m] = arr_conv_12_conv;
8077 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
8080 void ChannelManager_1process_1pending_1htlc_1forwards(void* ctx_TODO, uint32_t this_arg) {
8081 LDKChannelManager this_arg_conv;
8082 this_arg_conv.inner = (void*)(this_arg & (~1));
8083 this_arg_conv.is_owned = false;
8084 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
8087 void ChannelManager_1timer_1chan_1freshness_1every_1min(void* ctx_TODO, uint32_t this_arg) {
8088 LDKChannelManager this_arg_conv;
8089 this_arg_conv.inner = (void*)(this_arg & (~1));
8090 this_arg_conv.is_owned = false;
8091 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
8094 jboolean ChannelManager_1fail_1htlc_1backwards(void* ctx_TODO, uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
8095 LDKChannelManager this_arg_conv;
8096 this_arg_conv.inner = (void*)(this_arg & (~1));
8097 this_arg_conv.is_owned = false;
8098 unsigned char payment_hash_arr[32];
8099 CHECK(*payment_hash.len == 32);
8100 memcpy(payment_hash_arr, payment_hash.len + 1, 32);
8101 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
8102 LDKThirtyTwoBytes payment_secret_ref;
8103 CHECK(*payment_secret.len == 32);
8104 memcpy(payment_secret_ref.data, payment_secret.len + 1, 32);
8105 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
8109 jboolean ChannelManager_1claim_1funds(void* ctx_TODO, uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
8110 LDKChannelManager this_arg_conv;
8111 this_arg_conv.inner = (void*)(this_arg & (~1));
8112 this_arg_conv.is_owned = false;
8113 LDKThirtyTwoBytes payment_preimage_ref;
8114 CHECK(*payment_preimage.len == 32);
8115 memcpy(payment_preimage_ref.data, payment_preimage.len + 1, 32);
8116 LDKThirtyTwoBytes payment_secret_ref;
8117 CHECK(*payment_secret.len == 32);
8118 memcpy(payment_secret_ref.data, payment_secret.len + 1, 32);
8119 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
8123 int8_tArray ChannelManager_1get_1our_1node_1id(void* ctx_TODO, uint32_t this_arg) {
8124 LDKChannelManager this_arg_conv;
8125 this_arg_conv.inner = (void*)(this_arg & (~1));
8126 this_arg_conv.is_owned = false;
8127 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8128 memcpy(arg_arr.len + 1, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
8132 void ChannelManager_1channel_1monitor_1updated(void* ctx_TODO, uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
8133 LDKChannelManager this_arg_conv;
8134 this_arg_conv.inner = (void*)(this_arg & (~1));
8135 this_arg_conv.is_owned = false;
8136 LDKOutPoint funding_txo_conv;
8137 funding_txo_conv.inner = (void*)(funding_txo & (~1));
8138 funding_txo_conv.is_owned = false;
8139 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
8142 uint32_t ChannelManager_1as_1MessageSendEventsProvider(void* ctx_TODO, uint32_t this_arg) {
8143 LDKChannelManager this_arg_conv;
8144 this_arg_conv.inner = (void*)(this_arg & (~1));
8145 this_arg_conv.is_owned = false;
8146 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8147 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
8151 uint32_t ChannelManager_1as_1EventsProvider(void* ctx_TODO, uint32_t this_arg) {
8152 LDKChannelManager this_arg_conv;
8153 this_arg_conv.inner = (void*)(this_arg & (~1));
8154 this_arg_conv.is_owned = false;
8155 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8156 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
8160 void ChannelManager_1block_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
8161 LDKChannelManager this_arg_conv;
8162 this_arg_conv.inner = (void*)(this_arg & (~1));
8163 this_arg_conv.is_owned = false;
8164 unsigned char header_arr[80];
8165 CHECK(*header.len == 80);
8166 memcpy(header_arr, header.len + 1, 80);
8167 unsigned char (*header_ref)[80] = &header_arr;
8168 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8169 txdata_constr.datalen = *txdata.len;
8170 if (txdata_constr.datalen > 0)
8171 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8173 txdata_constr.data = NULL;
8174 uint32_t* txdata_vals = (uint32_t*)(txdata.len + 1);
8175 for (size_t e = 0; e < txdata_constr.datalen; e++) {
8176 uint32_t arr_conv_30 = txdata_vals[e];
8177 LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
8178 FREE((void*)arr_conv_30);
8179 txdata_constr.data[e] = arr_conv_30_conv;
8181 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
8184 void ChannelManager_1block_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray header) {
8185 LDKChannelManager this_arg_conv;
8186 this_arg_conv.inner = (void*)(this_arg & (~1));
8187 this_arg_conv.is_owned = false;
8188 unsigned char header_arr[80];
8189 CHECK(*header.len == 80);
8190 memcpy(header_arr, header.len + 1, 80);
8191 unsigned char (*header_ref)[80] = &header_arr;
8192 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
8195 uint32_t ChannelManager_1as_1ChannelMessageHandler(void* ctx_TODO, uint32_t this_arg) {
8196 LDKChannelManager this_arg_conv;
8197 this_arg_conv.inner = (void*)(this_arg & (~1));
8198 this_arg_conv.is_owned = false;
8199 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8200 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
8204 int8_tArray ChannelManager_1write(void* ctx_TODO, uint32_t obj) {
8205 LDKChannelManager obj_conv;
8206 obj_conv.inner = (void*)(obj & (~1));
8207 obj_conv.is_owned = false;
8208 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
8209 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
8210 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
8211 CVec_u8Z_free(arg_var);
8215 void ChannelManagerReadArgs_1free(void* ctx_TODO, uint32_t this_ptr) {
8216 LDKChannelManagerReadArgs this_ptr_conv;
8217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8219 ChannelManagerReadArgs_free(this_ptr_conv);
8222 uint32_t ChannelManagerReadArgs_1get_1keys_1manager(void* ctx_TODO, uint32_t this_ptr) {
8223 LDKChannelManagerReadArgs this_ptr_conv;
8224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8225 this_ptr_conv.is_owned = false;
8226 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
8230 void ChannelManagerReadArgs_1set_1keys_1manager(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8231 LDKChannelManagerReadArgs this_ptr_conv;
8232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8233 this_ptr_conv.is_owned = false;
8234 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
8235 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
8238 uint32_t ChannelManagerReadArgs_1get_1fee_1estimator(void* ctx_TODO, uint32_t this_ptr) {
8239 LDKChannelManagerReadArgs this_ptr_conv;
8240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8241 this_ptr_conv.is_owned = false;
8242 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
8246 void ChannelManagerReadArgs_1set_1fee_1estimator(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8247 LDKChannelManagerReadArgs this_ptr_conv;
8248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8249 this_ptr_conv.is_owned = false;
8250 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
8251 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
8254 uint32_t ChannelManagerReadArgs_1get_1chain_1monitor(void* ctx_TODO, uint32_t this_ptr) {
8255 LDKChannelManagerReadArgs this_ptr_conv;
8256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8257 this_ptr_conv.is_owned = false;
8258 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
8262 void ChannelManagerReadArgs_1set_1chain_1monitor(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8263 LDKChannelManagerReadArgs this_ptr_conv;
8264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8265 this_ptr_conv.is_owned = false;
8266 LDKWatch val_conv = *(LDKWatch*)val;
8267 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
8270 uint32_t ChannelManagerReadArgs_1get_1tx_1broadcaster(void* ctx_TODO, uint32_t this_ptr) {
8271 LDKChannelManagerReadArgs this_ptr_conv;
8272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8273 this_ptr_conv.is_owned = false;
8274 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
8278 void ChannelManagerReadArgs_1set_1tx_1broadcaster(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8279 LDKChannelManagerReadArgs this_ptr_conv;
8280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8281 this_ptr_conv.is_owned = false;
8282 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
8283 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
8286 uint32_t ChannelManagerReadArgs_1get_1logger(void* ctx_TODO, uint32_t this_ptr) {
8287 LDKChannelManagerReadArgs this_ptr_conv;
8288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8289 this_ptr_conv.is_owned = false;
8290 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
8294 void ChannelManagerReadArgs_1set_1logger(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8295 LDKChannelManagerReadArgs this_ptr_conv;
8296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8297 this_ptr_conv.is_owned = false;
8298 LDKLogger val_conv = *(LDKLogger*)val;
8299 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
8302 uint32_t ChannelManagerReadArgs_1get_1default_1config(void* ctx_TODO, uint32_t this_ptr) {
8303 LDKChannelManagerReadArgs this_ptr_conv;
8304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8305 this_ptr_conv.is_owned = false;
8306 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
8307 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8308 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8309 long ret_ref = (long)ret_var.inner;
8310 if (ret_var.is_owned) {
8316 void ChannelManagerReadArgs_1set_1default_1config(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
8317 LDKChannelManagerReadArgs this_ptr_conv;
8318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8319 this_ptr_conv.is_owned = false;
8320 LDKUserConfig val_conv;
8321 val_conv.inner = (void*)(val & (~1));
8322 val_conv.is_owned = (val & 1) || (val == 0);
8323 if (val_conv.inner != NULL)
8324 val_conv = UserConfig_clone(&val_conv);
8325 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
8328 uint32_t ChannelManagerReadArgs_1new(void* ctx_TODO, uint32_t keys_manager, uint32_t fee_estimator, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t default_config, uint32_tArray channel_monitors) {
8329 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
8330 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8331 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
8332 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
8333 LDKLogger logger_conv = *(LDKLogger*)logger;
8334 LDKUserConfig default_config_conv;
8335 default_config_conv.inner = (void*)(default_config & (~1));
8336 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
8337 if (default_config_conv.inner != NULL)
8338 default_config_conv = UserConfig_clone(&default_config_conv);
8339 LDKCVec_ChannelMonitorZ channel_monitors_constr;
8340 channel_monitors_constr.datalen = *channel_monitors.len;
8341 if (channel_monitors_constr.datalen > 0)
8342 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
8344 channel_monitors_constr.data = NULL;
8345 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors.len + 1);
8346 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
8347 uint32_t arr_conv_16 = channel_monitors_vals[q];
8348 LDKChannelMonitor arr_conv_16_conv;
8349 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
8350 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
8351 // Warning: we may need a move here but can't clone!
8352 channel_monitors_constr.data[q] = arr_conv_16_conv;
8354 LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
8355 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8356 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8357 long ret_ref = (long)ret_var.inner;
8358 if (ret_var.is_owned) {
8364 uint32_t C2Tuple_1BlockHashChannelManagerZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
8366 ser_ref.datalen = *ser.len;
8367 ser_ref.data = (int8_t*)(ser.len + 1);
8368 LDKChannelManagerReadArgs arg_conv;
8369 arg_conv.inner = (void*)(arg & (~1));
8370 arg_conv.is_owned = (arg & 1) || (arg == 0);
8371 // Warning: we may need a move here but can't clone!
8372 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
8373 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
8374 return (long)ret_conv;
8377 void DecodeError_1free(void* ctx_TODO, uint32_t this_ptr) {
8378 LDKDecodeError this_ptr_conv;
8379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8381 DecodeError_free(this_ptr_conv);
8384 void Init_1free(void* ctx_TODO, uint32_t this_ptr) {
8385 LDKInit this_ptr_conv;
8386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8388 Init_free(this_ptr_conv);
8391 uint32_t Init_1clone(void* ctx_TODO, uint32_t orig) {
8393 orig_conv.inner = (void*)(orig & (~1));
8394 orig_conv.is_owned = false;
8395 LDKInit ret_var = Init_clone(&orig_conv);
8396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8398 long ret_ref = (long)ret_var.inner;
8399 if (ret_var.is_owned) {
8405 void ErrorMessage_1free(void* ctx_TODO, uint32_t this_ptr) {
8406 LDKErrorMessage this_ptr_conv;
8407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8409 ErrorMessage_free(this_ptr_conv);
8412 uint32_t ErrorMessage_1clone(void* ctx_TODO, uint32_t orig) {
8413 LDKErrorMessage orig_conv;
8414 orig_conv.inner = (void*)(orig & (~1));
8415 orig_conv.is_owned = false;
8416 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
8417 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8418 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8419 long ret_ref = (long)ret_var.inner;
8420 if (ret_var.is_owned) {
8426 int8_tArray ErrorMessage_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8427 LDKErrorMessage this_ptr_conv;
8428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8429 this_ptr_conv.is_owned = false;
8430 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8431 memcpy(ret_arr.len + 1, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
8435 void ErrorMessage_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8436 LDKErrorMessage this_ptr_conv;
8437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8438 this_ptr_conv.is_owned = false;
8439 LDKThirtyTwoBytes val_ref;
8440 CHECK(*val.len == 32);
8441 memcpy(val_ref.data, val.len + 1, 32);
8442 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
8445 jstring ErrorMessage_1get_1data(void* ctx_TODO, uint32_t this_ptr) {
8446 LDKErrorMessage this_ptr_conv;
8447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8448 this_ptr_conv.is_owned = false;
8449 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
8450 char* _buf = MALLOC(_str.len + 1, "str conv buf");
8451 memcpy(_buf, _str.chars, _str.len);
8453 jstring _conv = conv_owned_string(_str.chars);
8458 void ErrorMessage_1set_1data(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8459 LDKErrorMessage this_ptr_conv;
8460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8461 this_ptr_conv.is_owned = false;
8462 LDKCVec_u8Z val_ref;
8463 val_ref.datalen = *val.len;
8464 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
8465 memcpy(val_ref.data, val.len + 1, val_ref.datalen);
8466 ErrorMessage_set_data(&this_ptr_conv, val_ref);
8469 uint32_t ErrorMessage_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray data_arg) {
8470 LDKThirtyTwoBytes channel_id_arg_ref;
8471 CHECK(*channel_id_arg.len == 32);
8472 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
8473 LDKCVec_u8Z data_arg_ref;
8474 data_arg_ref.datalen = *data_arg.len;
8475 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
8476 memcpy(data_arg_ref.data, data_arg.len + 1, data_arg_ref.datalen);
8477 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
8478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8480 long ret_ref = (long)ret_var.inner;
8481 if (ret_var.is_owned) {
8487 void Ping_1free(void* ctx_TODO, uint32_t this_ptr) {
8488 LDKPing this_ptr_conv;
8489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8491 Ping_free(this_ptr_conv);
8494 uint32_t Ping_1clone(void* ctx_TODO, uint32_t orig) {
8496 orig_conv.inner = (void*)(orig & (~1));
8497 orig_conv.is_owned = false;
8498 LDKPing ret_var = Ping_clone(&orig_conv);
8499 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8500 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8501 long ret_ref = (long)ret_var.inner;
8502 if (ret_var.is_owned) {
8508 int16_t Ping_1get_1ponglen(void* ctx_TODO, uint32_t this_ptr) {
8509 LDKPing this_ptr_conv;
8510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8511 this_ptr_conv.is_owned = false;
8512 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
8516 void Ping_1set_1ponglen(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8517 LDKPing this_ptr_conv;
8518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8519 this_ptr_conv.is_owned = false;
8520 Ping_set_ponglen(&this_ptr_conv, val);
8523 int16_t Ping_1get_1byteslen(void* ctx_TODO, uint32_t this_ptr) {
8524 LDKPing this_ptr_conv;
8525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8526 this_ptr_conv.is_owned = false;
8527 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
8531 void Ping_1set_1byteslen(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8532 LDKPing this_ptr_conv;
8533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8534 this_ptr_conv.is_owned = false;
8535 Ping_set_byteslen(&this_ptr_conv, val);
8538 uint32_t Ping_1new(void* ctx_TODO, int16_t ponglen_arg, int16_t byteslen_arg) {
8539 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
8540 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8541 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8542 long ret_ref = (long)ret_var.inner;
8543 if (ret_var.is_owned) {
8549 void Pong_1free(void* ctx_TODO, uint32_t this_ptr) {
8550 LDKPong this_ptr_conv;
8551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8553 Pong_free(this_ptr_conv);
8556 uint32_t Pong_1clone(void* ctx_TODO, uint32_t orig) {
8558 orig_conv.inner = (void*)(orig & (~1));
8559 orig_conv.is_owned = false;
8560 LDKPong ret_var = Pong_clone(&orig_conv);
8561 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8562 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8563 long ret_ref = (long)ret_var.inner;
8564 if (ret_var.is_owned) {
8570 int16_t Pong_1get_1byteslen(void* ctx_TODO, uint32_t this_ptr) {
8571 LDKPong this_ptr_conv;
8572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8573 this_ptr_conv.is_owned = false;
8574 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
8578 void Pong_1set_1byteslen(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8579 LDKPong this_ptr_conv;
8580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8581 this_ptr_conv.is_owned = false;
8582 Pong_set_byteslen(&this_ptr_conv, val);
8585 uint32_t Pong_1new(void* ctx_TODO, int16_t byteslen_arg) {
8586 LDKPong ret_var = Pong_new(byteslen_arg);
8587 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8588 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8589 long ret_ref = (long)ret_var.inner;
8590 if (ret_var.is_owned) {
8596 void OpenChannel_1free(void* ctx_TODO, uint32_t this_ptr) {
8597 LDKOpenChannel this_ptr_conv;
8598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8600 OpenChannel_free(this_ptr_conv);
8603 uint32_t OpenChannel_1clone(void* ctx_TODO, uint32_t orig) {
8604 LDKOpenChannel orig_conv;
8605 orig_conv.inner = (void*)(orig & (~1));
8606 orig_conv.is_owned = false;
8607 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
8608 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8609 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8610 long ret_ref = (long)ret_var.inner;
8611 if (ret_var.is_owned) {
8617 int8_tArray OpenChannel_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
8618 LDKOpenChannel this_ptr_conv;
8619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8620 this_ptr_conv.is_owned = false;
8621 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8622 memcpy(ret_arr.len + 1, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
8626 void OpenChannel_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8627 LDKOpenChannel this_ptr_conv;
8628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8629 this_ptr_conv.is_owned = false;
8630 LDKThirtyTwoBytes val_ref;
8631 CHECK(*val.len == 32);
8632 memcpy(val_ref.data, val.len + 1, 32);
8633 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
8636 int8_tArray OpenChannel_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8637 LDKOpenChannel this_ptr_conv;
8638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8639 this_ptr_conv.is_owned = false;
8640 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8641 memcpy(ret_arr.len + 1, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
8645 void OpenChannel_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8646 LDKOpenChannel this_ptr_conv;
8647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8648 this_ptr_conv.is_owned = false;
8649 LDKThirtyTwoBytes val_ref;
8650 CHECK(*val.len == 32);
8651 memcpy(val_ref.data, val.len + 1, 32);
8652 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8655 int64_t OpenChannel_1get_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8656 LDKOpenChannel this_ptr_conv;
8657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8658 this_ptr_conv.is_owned = false;
8659 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
8663 void OpenChannel_1set_1funding_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8664 LDKOpenChannel this_ptr_conv;
8665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8666 this_ptr_conv.is_owned = false;
8667 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
8670 int64_t OpenChannel_1get_1push_1msat(void* ctx_TODO, uint32_t this_ptr) {
8671 LDKOpenChannel this_ptr_conv;
8672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8673 this_ptr_conv.is_owned = false;
8674 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
8678 void OpenChannel_1set_1push_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8679 LDKOpenChannel this_ptr_conv;
8680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8681 this_ptr_conv.is_owned = false;
8682 OpenChannel_set_push_msat(&this_ptr_conv, val);
8685 int64_t OpenChannel_1get_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8686 LDKOpenChannel this_ptr_conv;
8687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8688 this_ptr_conv.is_owned = false;
8689 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
8693 void OpenChannel_1set_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8694 LDKOpenChannel this_ptr_conv;
8695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8696 this_ptr_conv.is_owned = false;
8697 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8700 int64_t OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
8701 LDKOpenChannel this_ptr_conv;
8702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8703 this_ptr_conv.is_owned = false;
8704 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8708 void OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8709 LDKOpenChannel this_ptr_conv;
8710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8711 this_ptr_conv.is_owned = false;
8712 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8715 int64_t OpenChannel_1get_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8716 LDKOpenChannel this_ptr_conv;
8717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8718 this_ptr_conv.is_owned = false;
8719 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8723 void OpenChannel_1set_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8724 LDKOpenChannel this_ptr_conv;
8725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8726 this_ptr_conv.is_owned = false;
8727 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8730 int64_t OpenChannel_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
8731 LDKOpenChannel this_ptr_conv;
8732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8733 this_ptr_conv.is_owned = false;
8734 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8738 void OpenChannel_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8739 LDKOpenChannel this_ptr_conv;
8740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8741 this_ptr_conv.is_owned = false;
8742 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8745 int32_t OpenChannel_1get_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr) {
8746 LDKOpenChannel this_ptr_conv;
8747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8748 this_ptr_conv.is_owned = false;
8749 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8753 void OpenChannel_1set_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
8754 LDKOpenChannel this_ptr_conv;
8755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8756 this_ptr_conv.is_owned = false;
8757 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8760 int16_t OpenChannel_1get_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
8761 LDKOpenChannel this_ptr_conv;
8762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8763 this_ptr_conv.is_owned = false;
8764 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8768 void OpenChannel_1set_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8769 LDKOpenChannel this_ptr_conv;
8770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8771 this_ptr_conv.is_owned = false;
8772 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8775 int16_t OpenChannel_1get_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
8776 LDKOpenChannel this_ptr_conv;
8777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8778 this_ptr_conv.is_owned = false;
8779 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8783 void OpenChannel_1set_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
8784 LDKOpenChannel this_ptr_conv;
8785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8786 this_ptr_conv.is_owned = false;
8787 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8790 int8_tArray OpenChannel_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
8791 LDKOpenChannel this_ptr_conv;
8792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8793 this_ptr_conv.is_owned = false;
8794 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8795 memcpy(arg_arr.len + 1, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
8799 void OpenChannel_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8800 LDKOpenChannel this_ptr_conv;
8801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8802 this_ptr_conv.is_owned = false;
8803 LDKPublicKey val_ref;
8804 CHECK(*val.len == 33);
8805 memcpy(val_ref.compressed_form, val.len + 1, 33);
8806 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8809 int8_tArray OpenChannel_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
8810 LDKOpenChannel this_ptr_conv;
8811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8812 this_ptr_conv.is_owned = false;
8813 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8814 memcpy(arg_arr.len + 1, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
8818 void OpenChannel_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8819 LDKOpenChannel this_ptr_conv;
8820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8821 this_ptr_conv.is_owned = false;
8822 LDKPublicKey val_ref;
8823 CHECK(*val.len == 33);
8824 memcpy(val_ref.compressed_form, val.len + 1, 33);
8825 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8828 int8_tArray OpenChannel_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
8829 LDKOpenChannel this_ptr_conv;
8830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8831 this_ptr_conv.is_owned = false;
8832 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8833 memcpy(arg_arr.len + 1, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
8837 void OpenChannel_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8838 LDKOpenChannel this_ptr_conv;
8839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8840 this_ptr_conv.is_owned = false;
8841 LDKPublicKey val_ref;
8842 CHECK(*val.len == 33);
8843 memcpy(val_ref.compressed_form, val.len + 1, 33);
8844 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8847 int8_tArray OpenChannel_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
8848 LDKOpenChannel this_ptr_conv;
8849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8850 this_ptr_conv.is_owned = false;
8851 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8852 memcpy(arg_arr.len + 1, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
8856 void OpenChannel_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8857 LDKOpenChannel this_ptr_conv;
8858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8859 this_ptr_conv.is_owned = false;
8860 LDKPublicKey val_ref;
8861 CHECK(*val.len == 33);
8862 memcpy(val_ref.compressed_form, val.len + 1, 33);
8863 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8866 int8_tArray OpenChannel_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
8867 LDKOpenChannel this_ptr_conv;
8868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8869 this_ptr_conv.is_owned = false;
8870 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8871 memcpy(arg_arr.len + 1, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
8875 void OpenChannel_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8876 LDKOpenChannel this_ptr_conv;
8877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8878 this_ptr_conv.is_owned = false;
8879 LDKPublicKey val_ref;
8880 CHECK(*val.len == 33);
8881 memcpy(val_ref.compressed_form, val.len + 1, 33);
8882 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8885 int8_tArray OpenChannel_1get_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
8886 LDKOpenChannel this_ptr_conv;
8887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8888 this_ptr_conv.is_owned = false;
8889 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8890 memcpy(arg_arr.len + 1, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
8894 void OpenChannel_1set_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8895 LDKOpenChannel this_ptr_conv;
8896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8897 this_ptr_conv.is_owned = false;
8898 LDKPublicKey val_ref;
8899 CHECK(*val.len == 33);
8900 memcpy(val_ref.compressed_form, val.len + 1, 33);
8901 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8904 int8_t OpenChannel_1get_1channel_1flags(void* ctx_TODO, uint32_t this_ptr) {
8905 LDKOpenChannel this_ptr_conv;
8906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8907 this_ptr_conv.is_owned = false;
8908 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8912 void OpenChannel_1set_1channel_1flags(void* ctx_TODO, uint32_t this_ptr, int8_t val) {
8913 LDKOpenChannel this_ptr_conv;
8914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8915 this_ptr_conv.is_owned = false;
8916 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8919 void AcceptChannel_1free(void* ctx_TODO, uint32_t this_ptr) {
8920 LDKAcceptChannel this_ptr_conv;
8921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8923 AcceptChannel_free(this_ptr_conv);
8926 uint32_t AcceptChannel_1clone(void* ctx_TODO, uint32_t orig) {
8927 LDKAcceptChannel orig_conv;
8928 orig_conv.inner = (void*)(orig & (~1));
8929 orig_conv.is_owned = false;
8930 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8933 long ret_ref = (long)ret_var.inner;
8934 if (ret_var.is_owned) {
8940 int8_tArray AcceptChannel_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
8941 LDKAcceptChannel this_ptr_conv;
8942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8943 this_ptr_conv.is_owned = false;
8944 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
8945 memcpy(ret_arr.len + 1, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
8949 void AcceptChannel_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
8950 LDKAcceptChannel this_ptr_conv;
8951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8952 this_ptr_conv.is_owned = false;
8953 LDKThirtyTwoBytes val_ref;
8954 CHECK(*val.len == 32);
8955 memcpy(val_ref.data, val.len + 1, 32);
8956 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8959 int64_t AcceptChannel_1get_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8960 LDKAcceptChannel this_ptr_conv;
8961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8962 this_ptr_conv.is_owned = false;
8963 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8967 void AcceptChannel_1set_1dust_1limit_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8968 LDKAcceptChannel this_ptr_conv;
8969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8970 this_ptr_conv.is_owned = false;
8971 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8974 int64_t AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr) {
8975 LDKAcceptChannel this_ptr_conv;
8976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8977 this_ptr_conv.is_owned = false;
8978 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8982 void AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8983 LDKAcceptChannel this_ptr_conv;
8984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8985 this_ptr_conv.is_owned = false;
8986 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8989 int64_t AcceptChannel_1get_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
8990 LDKAcceptChannel this_ptr_conv;
8991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8992 this_ptr_conv.is_owned = false;
8993 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8997 void AcceptChannel_1set_1channel_1reserve_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
8998 LDKAcceptChannel this_ptr_conv;
8999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9000 this_ptr_conv.is_owned = false;
9001 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
9004 int64_t AcceptChannel_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
9005 LDKAcceptChannel this_ptr_conv;
9006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9007 this_ptr_conv.is_owned = false;
9008 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
9012 void AcceptChannel_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9013 LDKAcceptChannel this_ptr_conv;
9014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9015 this_ptr_conv.is_owned = false;
9016 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
9019 int32_t AcceptChannel_1get_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr) {
9020 LDKAcceptChannel this_ptr_conv;
9021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9022 this_ptr_conv.is_owned = false;
9023 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
9027 void AcceptChannel_1set_1minimum_1depth(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9028 LDKAcceptChannel this_ptr_conv;
9029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9030 this_ptr_conv.is_owned = false;
9031 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
9034 int16_t AcceptChannel_1get_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr) {
9035 LDKAcceptChannel this_ptr_conv;
9036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9037 this_ptr_conv.is_owned = false;
9038 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
9042 void AcceptChannel_1set_1to_1self_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9043 LDKAcceptChannel this_ptr_conv;
9044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9045 this_ptr_conv.is_owned = false;
9046 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
9049 int16_t AcceptChannel_1get_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr) {
9050 LDKAcceptChannel this_ptr_conv;
9051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9052 this_ptr_conv.is_owned = false;
9053 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
9057 void AcceptChannel_1set_1max_1accepted_1htlcs(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9058 LDKAcceptChannel this_ptr_conv;
9059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9060 this_ptr_conv.is_owned = false;
9061 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
9064 int8_tArray AcceptChannel_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
9065 LDKAcceptChannel this_ptr_conv;
9066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9067 this_ptr_conv.is_owned = false;
9068 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9069 memcpy(arg_arr.len + 1, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
9073 void AcceptChannel_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9074 LDKAcceptChannel this_ptr_conv;
9075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9076 this_ptr_conv.is_owned = false;
9077 LDKPublicKey val_ref;
9078 CHECK(*val.len == 33);
9079 memcpy(val_ref.compressed_form, val.len + 1, 33);
9080 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
9083 int8_tArray AcceptChannel_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
9084 LDKAcceptChannel this_ptr_conv;
9085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9086 this_ptr_conv.is_owned = false;
9087 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9088 memcpy(arg_arr.len + 1, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
9092 void AcceptChannel_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9093 LDKAcceptChannel this_ptr_conv;
9094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9095 this_ptr_conv.is_owned = false;
9096 LDKPublicKey val_ref;
9097 CHECK(*val.len == 33);
9098 memcpy(val_ref.compressed_form, val.len + 1, 33);
9099 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
9102 int8_tArray AcceptChannel_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
9103 LDKAcceptChannel this_ptr_conv;
9104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9105 this_ptr_conv.is_owned = false;
9106 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9107 memcpy(arg_arr.len + 1, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
9111 void AcceptChannel_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9112 LDKAcceptChannel this_ptr_conv;
9113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9114 this_ptr_conv.is_owned = false;
9115 LDKPublicKey val_ref;
9116 CHECK(*val.len == 33);
9117 memcpy(val_ref.compressed_form, val.len + 1, 33);
9118 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
9121 int8_tArray AcceptChannel_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
9122 LDKAcceptChannel this_ptr_conv;
9123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9124 this_ptr_conv.is_owned = false;
9125 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9126 memcpy(arg_arr.len + 1, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
9130 void AcceptChannel_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9131 LDKAcceptChannel this_ptr_conv;
9132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9133 this_ptr_conv.is_owned = false;
9134 LDKPublicKey val_ref;
9135 CHECK(*val.len == 33);
9136 memcpy(val_ref.compressed_form, val.len + 1, 33);
9137 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
9140 int8_tArray AcceptChannel_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
9141 LDKAcceptChannel this_ptr_conv;
9142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9143 this_ptr_conv.is_owned = false;
9144 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9145 memcpy(arg_arr.len + 1, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
9149 void AcceptChannel_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9150 LDKAcceptChannel this_ptr_conv;
9151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9152 this_ptr_conv.is_owned = false;
9153 LDKPublicKey val_ref;
9154 CHECK(*val.len == 33);
9155 memcpy(val_ref.compressed_form, val.len + 1, 33);
9156 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
9159 int8_tArray AcceptChannel_1get_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
9160 LDKAcceptChannel this_ptr_conv;
9161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9162 this_ptr_conv.is_owned = false;
9163 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9164 memcpy(arg_arr.len + 1, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
9168 void AcceptChannel_1set_1first_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9169 LDKAcceptChannel this_ptr_conv;
9170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9171 this_ptr_conv.is_owned = false;
9172 LDKPublicKey val_ref;
9173 CHECK(*val.len == 33);
9174 memcpy(val_ref.compressed_form, val.len + 1, 33);
9175 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
9178 void FundingCreated_1free(void* ctx_TODO, uint32_t this_ptr) {
9179 LDKFundingCreated this_ptr_conv;
9180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9182 FundingCreated_free(this_ptr_conv);
9185 uint32_t FundingCreated_1clone(void* ctx_TODO, uint32_t orig) {
9186 LDKFundingCreated orig_conv;
9187 orig_conv.inner = (void*)(orig & (~1));
9188 orig_conv.is_owned = false;
9189 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
9190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9192 long ret_ref = (long)ret_var.inner;
9193 if (ret_var.is_owned) {
9199 int8_tArray FundingCreated_1get_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9200 LDKFundingCreated this_ptr_conv;
9201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9202 this_ptr_conv.is_owned = false;
9203 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9204 memcpy(ret_arr.len + 1, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
9208 void FundingCreated_1set_1temporary_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9209 LDKFundingCreated this_ptr_conv;
9210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9211 this_ptr_conv.is_owned = false;
9212 LDKThirtyTwoBytes val_ref;
9213 CHECK(*val.len == 32);
9214 memcpy(val_ref.data, val.len + 1, 32);
9215 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
9218 int8_tArray FundingCreated_1get_1funding_1txid(void* ctx_TODO, uint32_t this_ptr) {
9219 LDKFundingCreated this_ptr_conv;
9220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9221 this_ptr_conv.is_owned = false;
9222 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9223 memcpy(ret_arr.len + 1, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
9227 void FundingCreated_1set_1funding_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9228 LDKFundingCreated this_ptr_conv;
9229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9230 this_ptr_conv.is_owned = false;
9231 LDKThirtyTwoBytes val_ref;
9232 CHECK(*val.len == 32);
9233 memcpy(val_ref.data, val.len + 1, 32);
9234 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
9237 int16_t FundingCreated_1get_1funding_1output_1index(void* ctx_TODO, uint32_t this_ptr) {
9238 LDKFundingCreated this_ptr_conv;
9239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9240 this_ptr_conv.is_owned = false;
9241 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
9245 void FundingCreated_1set_1funding_1output_1index(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9246 LDKFundingCreated this_ptr_conv;
9247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9248 this_ptr_conv.is_owned = false;
9249 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
9252 int8_tArray FundingCreated_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9253 LDKFundingCreated this_ptr_conv;
9254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9255 this_ptr_conv.is_owned = false;
9256 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9257 memcpy(arg_arr.len + 1, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
9261 void FundingCreated_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9262 LDKFundingCreated this_ptr_conv;
9263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9264 this_ptr_conv.is_owned = false;
9265 LDKSignature val_ref;
9266 CHECK(*val.len == 64);
9267 memcpy(val_ref.compact_form, val.len + 1, 64);
9268 FundingCreated_set_signature(&this_ptr_conv, val_ref);
9271 uint32_t FundingCreated_1new(void* ctx_TODO, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
9272 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
9273 CHECK(*temporary_channel_id_arg.len == 32);
9274 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg.len + 1, 32);
9275 LDKThirtyTwoBytes funding_txid_arg_ref;
9276 CHECK(*funding_txid_arg.len == 32);
9277 memcpy(funding_txid_arg_ref.data, funding_txid_arg.len + 1, 32);
9278 LDKSignature signature_arg_ref;
9279 CHECK(*signature_arg.len == 64);
9280 memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
9281 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
9282 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9283 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9284 long ret_ref = (long)ret_var.inner;
9285 if (ret_var.is_owned) {
9291 void FundingSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
9292 LDKFundingSigned this_ptr_conv;
9293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9295 FundingSigned_free(this_ptr_conv);
9298 uint32_t FundingSigned_1clone(void* ctx_TODO, uint32_t orig) {
9299 LDKFundingSigned orig_conv;
9300 orig_conv.inner = (void*)(orig & (~1));
9301 orig_conv.is_owned = false;
9302 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
9303 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9304 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9305 long ret_ref = (long)ret_var.inner;
9306 if (ret_var.is_owned) {
9312 int8_tArray FundingSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9313 LDKFundingSigned this_ptr_conv;
9314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9315 this_ptr_conv.is_owned = false;
9316 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9317 memcpy(ret_arr.len + 1, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
9321 void FundingSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9322 LDKFundingSigned this_ptr_conv;
9323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9324 this_ptr_conv.is_owned = false;
9325 LDKThirtyTwoBytes val_ref;
9326 CHECK(*val.len == 32);
9327 memcpy(val_ref.data, val.len + 1, 32);
9328 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
9331 int8_tArray FundingSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9332 LDKFundingSigned this_ptr_conv;
9333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9334 this_ptr_conv.is_owned = false;
9335 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9336 memcpy(arg_arr.len + 1, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
9340 void FundingSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9341 LDKFundingSigned this_ptr_conv;
9342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9343 this_ptr_conv.is_owned = false;
9344 LDKSignature val_ref;
9345 CHECK(*val.len == 64);
9346 memcpy(val_ref.compact_form, val.len + 1, 64);
9347 FundingSigned_set_signature(&this_ptr_conv, val_ref);
9350 uint32_t FundingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg) {
9351 LDKThirtyTwoBytes channel_id_arg_ref;
9352 CHECK(*channel_id_arg.len == 32);
9353 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
9354 LDKSignature signature_arg_ref;
9355 CHECK(*signature_arg.len == 64);
9356 memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
9357 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
9358 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9359 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9360 long ret_ref = (long)ret_var.inner;
9361 if (ret_var.is_owned) {
9367 void FundingLocked_1free(void* ctx_TODO, uint32_t this_ptr) {
9368 LDKFundingLocked this_ptr_conv;
9369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9371 FundingLocked_free(this_ptr_conv);
9374 uint32_t FundingLocked_1clone(void* ctx_TODO, uint32_t orig) {
9375 LDKFundingLocked orig_conv;
9376 orig_conv.inner = (void*)(orig & (~1));
9377 orig_conv.is_owned = false;
9378 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
9379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9381 long ret_ref = (long)ret_var.inner;
9382 if (ret_var.is_owned) {
9388 int8_tArray FundingLocked_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9389 LDKFundingLocked this_ptr_conv;
9390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9391 this_ptr_conv.is_owned = false;
9392 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9393 memcpy(ret_arr.len + 1, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
9397 void FundingLocked_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9398 LDKFundingLocked this_ptr_conv;
9399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9400 this_ptr_conv.is_owned = false;
9401 LDKThirtyTwoBytes val_ref;
9402 CHECK(*val.len == 32);
9403 memcpy(val_ref.data, val.len + 1, 32);
9404 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
9407 int8_tArray FundingLocked_1get_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
9408 LDKFundingLocked this_ptr_conv;
9409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9410 this_ptr_conv.is_owned = false;
9411 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9412 memcpy(arg_arr.len + 1, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
9416 void FundingLocked_1set_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9417 LDKFundingLocked this_ptr_conv;
9418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9419 this_ptr_conv.is_owned = false;
9420 LDKPublicKey val_ref;
9421 CHECK(*val.len == 33);
9422 memcpy(val_ref.compressed_form, val.len + 1, 33);
9423 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9426 uint32_t FundingLocked_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
9427 LDKThirtyTwoBytes channel_id_arg_ref;
9428 CHECK(*channel_id_arg.len == 32);
9429 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
9430 LDKPublicKey next_per_commitment_point_arg_ref;
9431 CHECK(*next_per_commitment_point_arg.len == 33);
9432 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.len + 1, 33);
9433 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
9434 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9435 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9436 long ret_ref = (long)ret_var.inner;
9437 if (ret_var.is_owned) {
9443 void Shutdown_1free(void* ctx_TODO, uint32_t this_ptr) {
9444 LDKShutdown this_ptr_conv;
9445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9447 Shutdown_free(this_ptr_conv);
9450 uint32_t Shutdown_1clone(void* ctx_TODO, uint32_t orig) {
9451 LDKShutdown orig_conv;
9452 orig_conv.inner = (void*)(orig & (~1));
9453 orig_conv.is_owned = false;
9454 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
9455 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9456 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9457 long ret_ref = (long)ret_var.inner;
9458 if (ret_var.is_owned) {
9464 int8_tArray Shutdown_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9465 LDKShutdown this_ptr_conv;
9466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9467 this_ptr_conv.is_owned = false;
9468 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9469 memcpy(ret_arr.len + 1, *Shutdown_get_channel_id(&this_ptr_conv), 32);
9473 void Shutdown_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9474 LDKShutdown this_ptr_conv;
9475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9476 this_ptr_conv.is_owned = false;
9477 LDKThirtyTwoBytes val_ref;
9478 CHECK(*val.len == 32);
9479 memcpy(val_ref.data, val.len + 1, 32);
9480 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
9483 int8_tArray Shutdown_1get_1scriptpubkey(void* ctx_TODO, uint32_t this_ptr) {
9484 LDKShutdown this_ptr_conv;
9485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9486 this_ptr_conv.is_owned = false;
9487 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
9488 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
9489 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
9493 void Shutdown_1set_1scriptpubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9494 LDKShutdown this_ptr_conv;
9495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9496 this_ptr_conv.is_owned = false;
9497 LDKCVec_u8Z val_ref;
9498 val_ref.datalen = *val.len;
9499 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9500 memcpy(val_ref.data, val.len + 1, val_ref.datalen);
9501 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
9504 uint32_t Shutdown_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
9505 LDKThirtyTwoBytes channel_id_arg_ref;
9506 CHECK(*channel_id_arg.len == 32);
9507 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
9508 LDKCVec_u8Z scriptpubkey_arg_ref;
9509 scriptpubkey_arg_ref.datalen = *scriptpubkey_arg.len;
9510 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9511 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg.len + 1, scriptpubkey_arg_ref.datalen);
9512 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
9513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9515 long ret_ref = (long)ret_var.inner;
9516 if (ret_var.is_owned) {
9522 void ClosingSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
9523 LDKClosingSigned this_ptr_conv;
9524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9526 ClosingSigned_free(this_ptr_conv);
9529 uint32_t ClosingSigned_1clone(void* ctx_TODO, uint32_t orig) {
9530 LDKClosingSigned orig_conv;
9531 orig_conv.inner = (void*)(orig & (~1));
9532 orig_conv.is_owned = false;
9533 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
9534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9536 long ret_ref = (long)ret_var.inner;
9537 if (ret_var.is_owned) {
9543 int8_tArray ClosingSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9544 LDKClosingSigned this_ptr_conv;
9545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9546 this_ptr_conv.is_owned = false;
9547 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9548 memcpy(ret_arr.len + 1, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
9552 void ClosingSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9553 LDKClosingSigned this_ptr_conv;
9554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9555 this_ptr_conv.is_owned = false;
9556 LDKThirtyTwoBytes val_ref;
9557 CHECK(*val.len == 32);
9558 memcpy(val_ref.data, val.len + 1, 32);
9559 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
9562 int64_t ClosingSigned_1get_1fee_1satoshis(void* ctx_TODO, uint32_t this_ptr) {
9563 LDKClosingSigned this_ptr_conv;
9564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9565 this_ptr_conv.is_owned = false;
9566 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
9570 void ClosingSigned_1set_1fee_1satoshis(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9571 LDKClosingSigned this_ptr_conv;
9572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9573 this_ptr_conv.is_owned = false;
9574 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
9577 int8_tArray ClosingSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9578 LDKClosingSigned this_ptr_conv;
9579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9580 this_ptr_conv.is_owned = false;
9581 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9582 memcpy(arg_arr.len + 1, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
9586 void ClosingSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9587 LDKClosingSigned this_ptr_conv;
9588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9589 this_ptr_conv.is_owned = false;
9590 LDKSignature val_ref;
9591 CHECK(*val.len == 64);
9592 memcpy(val_ref.compact_form, val.len + 1, 64);
9593 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
9596 uint32_t ClosingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
9597 LDKThirtyTwoBytes channel_id_arg_ref;
9598 CHECK(*channel_id_arg.len == 32);
9599 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
9600 LDKSignature signature_arg_ref;
9601 CHECK(*signature_arg.len == 64);
9602 memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
9603 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
9604 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9605 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9606 long ret_ref = (long)ret_var.inner;
9607 if (ret_var.is_owned) {
9613 void UpdateAddHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9614 LDKUpdateAddHTLC this_ptr_conv;
9615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9617 UpdateAddHTLC_free(this_ptr_conv);
9620 uint32_t UpdateAddHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9621 LDKUpdateAddHTLC orig_conv;
9622 orig_conv.inner = (void*)(orig & (~1));
9623 orig_conv.is_owned = false;
9624 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
9625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9627 long ret_ref = (long)ret_var.inner;
9628 if (ret_var.is_owned) {
9634 int8_tArray UpdateAddHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9635 LDKUpdateAddHTLC this_ptr_conv;
9636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9637 this_ptr_conv.is_owned = false;
9638 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9639 memcpy(ret_arr.len + 1, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
9643 void UpdateAddHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9644 LDKUpdateAddHTLC this_ptr_conv;
9645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9646 this_ptr_conv.is_owned = false;
9647 LDKThirtyTwoBytes val_ref;
9648 CHECK(*val.len == 32);
9649 memcpy(val_ref.data, val.len + 1, 32);
9650 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
9653 int64_t UpdateAddHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9654 LDKUpdateAddHTLC this_ptr_conv;
9655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9656 this_ptr_conv.is_owned = false;
9657 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
9661 void UpdateAddHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9662 LDKUpdateAddHTLC this_ptr_conv;
9663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9664 this_ptr_conv.is_owned = false;
9665 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
9668 int64_t UpdateAddHTLC_1get_1amount_1msat(void* ctx_TODO, uint32_t this_ptr) {
9669 LDKUpdateAddHTLC this_ptr_conv;
9670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9671 this_ptr_conv.is_owned = false;
9672 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
9676 void UpdateAddHTLC_1set_1amount_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9677 LDKUpdateAddHTLC this_ptr_conv;
9678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9679 this_ptr_conv.is_owned = false;
9680 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
9683 int8_tArray UpdateAddHTLC_1get_1payment_1hash(void* ctx_TODO, uint32_t this_ptr) {
9684 LDKUpdateAddHTLC this_ptr_conv;
9685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9686 this_ptr_conv.is_owned = false;
9687 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9688 memcpy(ret_arr.len + 1, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
9692 void UpdateAddHTLC_1set_1payment_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9693 LDKUpdateAddHTLC this_ptr_conv;
9694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9695 this_ptr_conv.is_owned = false;
9696 LDKThirtyTwoBytes val_ref;
9697 CHECK(*val.len == 32);
9698 memcpy(val_ref.data, val.len + 1, 32);
9699 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
9702 int32_t UpdateAddHTLC_1get_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr) {
9703 LDKUpdateAddHTLC this_ptr_conv;
9704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9705 this_ptr_conv.is_owned = false;
9706 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
9710 void UpdateAddHTLC_1set_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
9711 LDKUpdateAddHTLC this_ptr_conv;
9712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9713 this_ptr_conv.is_owned = false;
9714 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9717 void UpdateFulfillHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9718 LDKUpdateFulfillHTLC this_ptr_conv;
9719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9720 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9721 UpdateFulfillHTLC_free(this_ptr_conv);
9724 uint32_t UpdateFulfillHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9725 LDKUpdateFulfillHTLC orig_conv;
9726 orig_conv.inner = (void*)(orig & (~1));
9727 orig_conv.is_owned = false;
9728 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9729 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9730 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9731 long ret_ref = (long)ret_var.inner;
9732 if (ret_var.is_owned) {
9738 int8_tArray UpdateFulfillHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9739 LDKUpdateFulfillHTLC this_ptr_conv;
9740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9741 this_ptr_conv.is_owned = false;
9742 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9743 memcpy(ret_arr.len + 1, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
9747 void UpdateFulfillHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9748 LDKUpdateFulfillHTLC this_ptr_conv;
9749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9750 this_ptr_conv.is_owned = false;
9751 LDKThirtyTwoBytes val_ref;
9752 CHECK(*val.len == 32);
9753 memcpy(val_ref.data, val.len + 1, 32);
9754 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9757 int64_t UpdateFulfillHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9758 LDKUpdateFulfillHTLC this_ptr_conv;
9759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9760 this_ptr_conv.is_owned = false;
9761 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9765 void UpdateFulfillHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9766 LDKUpdateFulfillHTLC this_ptr_conv;
9767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9768 this_ptr_conv.is_owned = false;
9769 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9772 int8_tArray UpdateFulfillHTLC_1get_1payment_1preimage(void* ctx_TODO, uint32_t this_ptr) {
9773 LDKUpdateFulfillHTLC this_ptr_conv;
9774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9775 this_ptr_conv.is_owned = false;
9776 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9777 memcpy(ret_arr.len + 1, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
9781 void UpdateFulfillHTLC_1set_1payment_1preimage(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9782 LDKUpdateFulfillHTLC this_ptr_conv;
9783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9784 this_ptr_conv.is_owned = false;
9785 LDKThirtyTwoBytes val_ref;
9786 CHECK(*val.len == 32);
9787 memcpy(val_ref.data, val.len + 1, 32);
9788 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9791 uint32_t UpdateFulfillHTLC_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
9792 LDKThirtyTwoBytes channel_id_arg_ref;
9793 CHECK(*channel_id_arg.len == 32);
9794 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
9795 LDKThirtyTwoBytes payment_preimage_arg_ref;
9796 CHECK(*payment_preimage_arg.len == 32);
9797 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg.len + 1, 32);
9798 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9799 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9800 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9801 long ret_ref = (long)ret_var.inner;
9802 if (ret_var.is_owned) {
9808 void UpdateFailHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9809 LDKUpdateFailHTLC this_ptr_conv;
9810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9812 UpdateFailHTLC_free(this_ptr_conv);
9815 uint32_t UpdateFailHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9816 LDKUpdateFailHTLC orig_conv;
9817 orig_conv.inner = (void*)(orig & (~1));
9818 orig_conv.is_owned = false;
9819 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9822 long ret_ref = (long)ret_var.inner;
9823 if (ret_var.is_owned) {
9829 int8_tArray UpdateFailHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9830 LDKUpdateFailHTLC this_ptr_conv;
9831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9832 this_ptr_conv.is_owned = false;
9833 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9834 memcpy(ret_arr.len + 1, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
9838 void UpdateFailHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9839 LDKUpdateFailHTLC this_ptr_conv;
9840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9841 this_ptr_conv.is_owned = false;
9842 LDKThirtyTwoBytes val_ref;
9843 CHECK(*val.len == 32);
9844 memcpy(val_ref.data, val.len + 1, 32);
9845 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9848 int64_t UpdateFailHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9849 LDKUpdateFailHTLC this_ptr_conv;
9850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9851 this_ptr_conv.is_owned = false;
9852 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9856 void UpdateFailHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9857 LDKUpdateFailHTLC this_ptr_conv;
9858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9859 this_ptr_conv.is_owned = false;
9860 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9863 void UpdateFailMalformedHTLC_1free(void* ctx_TODO, uint32_t this_ptr) {
9864 LDKUpdateFailMalformedHTLC this_ptr_conv;
9865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9867 UpdateFailMalformedHTLC_free(this_ptr_conv);
9870 uint32_t UpdateFailMalformedHTLC_1clone(void* ctx_TODO, uint32_t orig) {
9871 LDKUpdateFailMalformedHTLC orig_conv;
9872 orig_conv.inner = (void*)(orig & (~1));
9873 orig_conv.is_owned = false;
9874 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9875 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9876 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9877 long ret_ref = (long)ret_var.inner;
9878 if (ret_var.is_owned) {
9884 int8_tArray UpdateFailMalformedHTLC_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9885 LDKUpdateFailMalformedHTLC this_ptr_conv;
9886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9887 this_ptr_conv.is_owned = false;
9888 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9889 memcpy(ret_arr.len + 1, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
9893 void UpdateFailMalformedHTLC_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9894 LDKUpdateFailMalformedHTLC this_ptr_conv;
9895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9896 this_ptr_conv.is_owned = false;
9897 LDKThirtyTwoBytes val_ref;
9898 CHECK(*val.len == 32);
9899 memcpy(val_ref.data, val.len + 1, 32);
9900 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9903 int64_t UpdateFailMalformedHTLC_1get_1htlc_1id(void* ctx_TODO, uint32_t this_ptr) {
9904 LDKUpdateFailMalformedHTLC this_ptr_conv;
9905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9906 this_ptr_conv.is_owned = false;
9907 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9911 void UpdateFailMalformedHTLC_1set_1htlc_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
9912 LDKUpdateFailMalformedHTLC this_ptr_conv;
9913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9914 this_ptr_conv.is_owned = false;
9915 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9918 int16_t UpdateFailMalformedHTLC_1get_1failure_1code(void* ctx_TODO, uint32_t this_ptr) {
9919 LDKUpdateFailMalformedHTLC this_ptr_conv;
9920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9921 this_ptr_conv.is_owned = false;
9922 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9926 void UpdateFailMalformedHTLC_1set_1failure_1code(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
9927 LDKUpdateFailMalformedHTLC this_ptr_conv;
9928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9929 this_ptr_conv.is_owned = false;
9930 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9933 void CommitmentSigned_1free(void* ctx_TODO, uint32_t this_ptr) {
9934 LDKCommitmentSigned this_ptr_conv;
9935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9937 CommitmentSigned_free(this_ptr_conv);
9940 uint32_t CommitmentSigned_1clone(void* ctx_TODO, uint32_t orig) {
9941 LDKCommitmentSigned orig_conv;
9942 orig_conv.inner = (void*)(orig & (~1));
9943 orig_conv.is_owned = false;
9944 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9945 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9946 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9947 long ret_ref = (long)ret_var.inner;
9948 if (ret_var.is_owned) {
9954 int8_tArray CommitmentSigned_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
9955 LDKCommitmentSigned this_ptr_conv;
9956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9957 this_ptr_conv.is_owned = false;
9958 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9959 memcpy(ret_arr.len + 1, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
9963 void CommitmentSigned_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9964 LDKCommitmentSigned this_ptr_conv;
9965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9966 this_ptr_conv.is_owned = false;
9967 LDKThirtyTwoBytes val_ref;
9968 CHECK(*val.len == 32);
9969 memcpy(val_ref.data, val.len + 1, 32);
9970 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9973 int8_tArray CommitmentSigned_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
9974 LDKCommitmentSigned this_ptr_conv;
9975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9976 this_ptr_conv.is_owned = false;
9977 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
9978 memcpy(arg_arr.len + 1, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
9982 void CommitmentSigned_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
9983 LDKCommitmentSigned this_ptr_conv;
9984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9985 this_ptr_conv.is_owned = false;
9986 LDKSignature val_ref;
9987 CHECK(*val.len == 64);
9988 memcpy(val_ref.compact_form, val.len + 1, 64);
9989 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9992 void CommitmentSigned_1set_1htlc_1signatures(void* ctx_TODO, uint32_t this_ptr, ptrArray val) {
9993 LDKCommitmentSigned this_ptr_conv;
9994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9995 this_ptr_conv.is_owned = false;
9996 LDKCVec_SignatureZ val_constr;
9997 val_constr.datalen = *val.len;
9998 if (val_constr.datalen > 0)
9999 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10001 val_constr.data = NULL;
10002 int8_tArray* val_vals = (int8_tArray*)(val.len + 1);
10003 for (size_t m = 0; m < val_constr.datalen; m++) {
10004 int8_tArray arr_conv_12 = val_vals[m];
10005 LDKSignature arr_conv_12_ref;
10006 CHECK(*arr_conv_12.len == 64);
10007 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
10008 val_constr.data[m] = arr_conv_12_ref;
10010 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
10013 uint32_t CommitmentSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
10014 LDKThirtyTwoBytes channel_id_arg_ref;
10015 CHECK(*channel_id_arg.len == 32);
10016 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
10017 LDKSignature signature_arg_ref;
10018 CHECK(*signature_arg.len == 64);
10019 memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
10020 LDKCVec_SignatureZ htlc_signatures_arg_constr;
10021 htlc_signatures_arg_constr.datalen = *htlc_signatures_arg.len;
10022 if (htlc_signatures_arg_constr.datalen > 0)
10023 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10025 htlc_signatures_arg_constr.data = NULL;
10026 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg.len + 1);
10027 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
10028 int8_tArray arr_conv_12 = htlc_signatures_arg_vals[m];
10029 LDKSignature arr_conv_12_ref;
10030 CHECK(*arr_conv_12.len == 64);
10031 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
10032 htlc_signatures_arg_constr.data[m] = arr_conv_12_ref;
10034 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
10035 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10036 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10037 long ret_ref = (long)ret_var.inner;
10038 if (ret_var.is_owned) {
10044 void RevokeAndACK_1free(void* ctx_TODO, uint32_t this_ptr) {
10045 LDKRevokeAndACK this_ptr_conv;
10046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10048 RevokeAndACK_free(this_ptr_conv);
10051 uint32_t RevokeAndACK_1clone(void* ctx_TODO, uint32_t orig) {
10052 LDKRevokeAndACK orig_conv;
10053 orig_conv.inner = (void*)(orig & (~1));
10054 orig_conv.is_owned = false;
10055 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
10056 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10057 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10058 long ret_ref = (long)ret_var.inner;
10059 if (ret_var.is_owned) {
10065 int8_tArray RevokeAndACK_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10066 LDKRevokeAndACK this_ptr_conv;
10067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10068 this_ptr_conv.is_owned = false;
10069 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10070 memcpy(ret_arr.len + 1, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
10074 void RevokeAndACK_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10075 LDKRevokeAndACK this_ptr_conv;
10076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10077 this_ptr_conv.is_owned = false;
10078 LDKThirtyTwoBytes val_ref;
10079 CHECK(*val.len == 32);
10080 memcpy(val_ref.data, val.len + 1, 32);
10081 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
10084 int8_tArray RevokeAndACK_1get_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr) {
10085 LDKRevokeAndACK this_ptr_conv;
10086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10087 this_ptr_conv.is_owned = false;
10088 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10089 memcpy(ret_arr.len + 1, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
10093 void RevokeAndACK_1set_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10094 LDKRevokeAndACK this_ptr_conv;
10095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10096 this_ptr_conv.is_owned = false;
10097 LDKThirtyTwoBytes val_ref;
10098 CHECK(*val.len == 32);
10099 memcpy(val_ref.data, val.len + 1, 32);
10100 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
10103 int8_tArray RevokeAndACK_1get_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
10104 LDKRevokeAndACK this_ptr_conv;
10105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10106 this_ptr_conv.is_owned = false;
10107 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10108 memcpy(arg_arr.len + 1, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10112 void RevokeAndACK_1set_1next_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10113 LDKRevokeAndACK this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = false;
10116 LDKPublicKey val_ref;
10117 CHECK(*val.len == 33);
10118 memcpy(val_ref.compressed_form, val.len + 1, 33);
10119 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
10122 uint32_t RevokeAndACK_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
10123 LDKThirtyTwoBytes channel_id_arg_ref;
10124 CHECK(*channel_id_arg.len == 32);
10125 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
10126 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
10127 CHECK(*per_commitment_secret_arg.len == 32);
10128 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg.len + 1, 32);
10129 LDKPublicKey next_per_commitment_point_arg_ref;
10130 CHECK(*next_per_commitment_point_arg.len == 33);
10131 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.len + 1, 33);
10132 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
10133 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10134 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10135 long ret_ref = (long)ret_var.inner;
10136 if (ret_var.is_owned) {
10142 void UpdateFee_1free(void* ctx_TODO, uint32_t this_ptr) {
10143 LDKUpdateFee this_ptr_conv;
10144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10146 UpdateFee_free(this_ptr_conv);
10149 uint32_t UpdateFee_1clone(void* ctx_TODO, uint32_t orig) {
10150 LDKUpdateFee orig_conv;
10151 orig_conv.inner = (void*)(orig & (~1));
10152 orig_conv.is_owned = false;
10153 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
10154 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10155 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10156 long ret_ref = (long)ret_var.inner;
10157 if (ret_var.is_owned) {
10163 int8_tArray UpdateFee_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10164 LDKUpdateFee this_ptr_conv;
10165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10166 this_ptr_conv.is_owned = false;
10167 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10168 memcpy(ret_arr.len + 1, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
10172 void UpdateFee_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10173 LDKUpdateFee this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = false;
10176 LDKThirtyTwoBytes val_ref;
10177 CHECK(*val.len == 32);
10178 memcpy(val_ref.data, val.len + 1, 32);
10179 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
10182 int32_t UpdateFee_1get_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr) {
10183 LDKUpdateFee this_ptr_conv;
10184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10185 this_ptr_conv.is_owned = false;
10186 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
10190 void UpdateFee_1set_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
10191 LDKUpdateFee this_ptr_conv;
10192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10193 this_ptr_conv.is_owned = false;
10194 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
10197 uint32_t UpdateFee_1new(void* ctx_TODO, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
10198 LDKThirtyTwoBytes channel_id_arg_ref;
10199 CHECK(*channel_id_arg.len == 32);
10200 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
10201 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
10202 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10203 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10204 long ret_ref = (long)ret_var.inner;
10205 if (ret_var.is_owned) {
10211 void DataLossProtect_1free(void* ctx_TODO, uint32_t this_ptr) {
10212 LDKDataLossProtect this_ptr_conv;
10213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10215 DataLossProtect_free(this_ptr_conv);
10218 uint32_t DataLossProtect_1clone(void* ctx_TODO, uint32_t orig) {
10219 LDKDataLossProtect orig_conv;
10220 orig_conv.inner = (void*)(orig & (~1));
10221 orig_conv.is_owned = false;
10222 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
10223 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10224 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10225 long ret_ref = (long)ret_var.inner;
10226 if (ret_var.is_owned) {
10232 int8_tArray DataLossProtect_1get_1your_1last_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr) {
10233 LDKDataLossProtect this_ptr_conv;
10234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10235 this_ptr_conv.is_owned = false;
10236 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10237 memcpy(ret_arr.len + 1, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
10241 void DataLossProtect_1set_1your_1last_1per_1commitment_1secret(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10242 LDKDataLossProtect this_ptr_conv;
10243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10244 this_ptr_conv.is_owned = false;
10245 LDKThirtyTwoBytes val_ref;
10246 CHECK(*val.len == 32);
10247 memcpy(val_ref.data, val.len + 1, 32);
10248 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
10251 int8_tArray DataLossProtect_1get_1my_1current_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
10252 LDKDataLossProtect this_ptr_conv;
10253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10254 this_ptr_conv.is_owned = false;
10255 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10256 memcpy(arg_arr.len + 1, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10260 void DataLossProtect_1set_1my_1current_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10261 LDKDataLossProtect this_ptr_conv;
10262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10263 this_ptr_conv.is_owned = false;
10264 LDKPublicKey val_ref;
10265 CHECK(*val.len == 33);
10266 memcpy(val_ref.compressed_form, val.len + 1, 33);
10267 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
10270 uint32_t DataLossProtect_1new(void* ctx_TODO, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
10271 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
10272 CHECK(*your_last_per_commitment_secret_arg.len == 32);
10273 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg.len + 1, 32);
10274 LDKPublicKey my_current_per_commitment_point_arg_ref;
10275 CHECK(*my_current_per_commitment_point_arg.len == 33);
10276 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg.len + 1, 33);
10277 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
10278 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10279 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10280 long ret_ref = (long)ret_var.inner;
10281 if (ret_var.is_owned) {
10287 void ChannelReestablish_1free(void* ctx_TODO, uint32_t this_ptr) {
10288 LDKChannelReestablish this_ptr_conv;
10289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10290 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10291 ChannelReestablish_free(this_ptr_conv);
10294 uint32_t ChannelReestablish_1clone(void* ctx_TODO, uint32_t orig) {
10295 LDKChannelReestablish orig_conv;
10296 orig_conv.inner = (void*)(orig & (~1));
10297 orig_conv.is_owned = false;
10298 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
10299 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10300 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10301 long ret_ref = (long)ret_var.inner;
10302 if (ret_var.is_owned) {
10308 int8_tArray ChannelReestablish_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10309 LDKChannelReestablish this_ptr_conv;
10310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10311 this_ptr_conv.is_owned = false;
10312 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10313 memcpy(ret_arr.len + 1, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
10317 void ChannelReestablish_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10318 LDKChannelReestablish this_ptr_conv;
10319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10320 this_ptr_conv.is_owned = false;
10321 LDKThirtyTwoBytes val_ref;
10322 CHECK(*val.len == 32);
10323 memcpy(val_ref.data, val.len + 1, 32);
10324 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
10327 int64_t ChannelReestablish_1get_1next_1local_1commitment_1number(void* ctx_TODO, uint32_t this_ptr) {
10328 LDKChannelReestablish this_ptr_conv;
10329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10330 this_ptr_conv.is_owned = false;
10331 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
10335 void ChannelReestablish_1set_1next_1local_1commitment_1number(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10336 LDKChannelReestablish this_ptr_conv;
10337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10338 this_ptr_conv.is_owned = false;
10339 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
10342 int64_t ChannelReestablish_1get_1next_1remote_1commitment_1number(void* ctx_TODO, uint32_t this_ptr) {
10343 LDKChannelReestablish this_ptr_conv;
10344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10345 this_ptr_conv.is_owned = false;
10346 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
10350 void ChannelReestablish_1set_1next_1remote_1commitment_1number(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10351 LDKChannelReestablish this_ptr_conv;
10352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10353 this_ptr_conv.is_owned = false;
10354 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
10357 void AnnouncementSignatures_1free(void* ctx_TODO, uint32_t this_ptr) {
10358 LDKAnnouncementSignatures this_ptr_conv;
10359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10361 AnnouncementSignatures_free(this_ptr_conv);
10364 uint32_t AnnouncementSignatures_1clone(void* ctx_TODO, uint32_t orig) {
10365 LDKAnnouncementSignatures orig_conv;
10366 orig_conv.inner = (void*)(orig & (~1));
10367 orig_conv.is_owned = false;
10368 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
10369 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10370 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10371 long ret_ref = (long)ret_var.inner;
10372 if (ret_var.is_owned) {
10378 int8_tArray AnnouncementSignatures_1get_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10379 LDKAnnouncementSignatures this_ptr_conv;
10380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10381 this_ptr_conv.is_owned = false;
10382 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10383 memcpy(ret_arr.len + 1, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
10387 void AnnouncementSignatures_1set_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10388 LDKAnnouncementSignatures this_ptr_conv;
10389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10390 this_ptr_conv.is_owned = false;
10391 LDKThirtyTwoBytes val_ref;
10392 CHECK(*val.len == 32);
10393 memcpy(val_ref.data, val.len + 1, 32);
10394 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
10397 int64_t AnnouncementSignatures_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10398 LDKAnnouncementSignatures this_ptr_conv;
10399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10400 this_ptr_conv.is_owned = false;
10401 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
10405 void AnnouncementSignatures_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10406 LDKAnnouncementSignatures this_ptr_conv;
10407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10408 this_ptr_conv.is_owned = false;
10409 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
10412 int8_tArray AnnouncementSignatures_1get_1node_1signature(void* ctx_TODO, uint32_t this_ptr) {
10413 LDKAnnouncementSignatures this_ptr_conv;
10414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10415 this_ptr_conv.is_owned = false;
10416 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10417 memcpy(arg_arr.len + 1, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
10421 void AnnouncementSignatures_1set_1node_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10422 LDKAnnouncementSignatures this_ptr_conv;
10423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10424 this_ptr_conv.is_owned = false;
10425 LDKSignature val_ref;
10426 CHECK(*val.len == 64);
10427 memcpy(val_ref.compact_form, val.len + 1, 64);
10428 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
10431 int8_tArray AnnouncementSignatures_1get_1bitcoin_1signature(void* ctx_TODO, uint32_t this_ptr) {
10432 LDKAnnouncementSignatures this_ptr_conv;
10433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10434 this_ptr_conv.is_owned = false;
10435 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10436 memcpy(arg_arr.len + 1, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
10440 void AnnouncementSignatures_1set_1bitcoin_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10441 LDKAnnouncementSignatures this_ptr_conv;
10442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10443 this_ptr_conv.is_owned = false;
10444 LDKSignature val_ref;
10445 CHECK(*val.len == 64);
10446 memcpy(val_ref.compact_form, val.len + 1, 64);
10447 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
10450 uint32_t AnnouncementSignatures_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
10451 LDKThirtyTwoBytes channel_id_arg_ref;
10452 CHECK(*channel_id_arg.len == 32);
10453 memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
10454 LDKSignature node_signature_arg_ref;
10455 CHECK(*node_signature_arg.len == 64);
10456 memcpy(node_signature_arg_ref.compact_form, node_signature_arg.len + 1, 64);
10457 LDKSignature bitcoin_signature_arg_ref;
10458 CHECK(*bitcoin_signature_arg.len == 64);
10459 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg.len + 1, 64);
10460 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
10461 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10462 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10463 long ret_ref = (long)ret_var.inner;
10464 if (ret_var.is_owned) {
10470 void NetAddress_1free(void* ctx_TODO, uint32_t this_ptr) {
10471 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
10472 FREE((void*)this_ptr);
10473 NetAddress_free(this_ptr_conv);
10476 uint32_t NetAddress_1clone(void* ctx_TODO, uint32_t orig) {
10477 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
10478 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
10479 *ret_copy = NetAddress_clone(orig_conv);
10480 long ret_ref = (long)ret_copy;
10484 int8_tArray NetAddress_1write(void* ctx_TODO, uint32_t obj) {
10485 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
10486 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
10487 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
10488 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
10489 CVec_u8Z_free(arg_var);
10493 uint32_t Result_1read(void* ctx_TODO, int8_tArray ser) {
10494 LDKu8slice ser_ref;
10495 ser_ref.datalen = *ser.len;
10496 ser_ref.data = (int8_t*)(ser.len + 1);
10497 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
10498 *ret_conv = Result_read(ser_ref);
10499 return (long)ret_conv;
10502 void UnsignedNodeAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10503 LDKUnsignedNodeAnnouncement this_ptr_conv;
10504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10506 UnsignedNodeAnnouncement_free(this_ptr_conv);
10509 uint32_t UnsignedNodeAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10510 LDKUnsignedNodeAnnouncement orig_conv;
10511 orig_conv.inner = (void*)(orig & (~1));
10512 orig_conv.is_owned = false;
10513 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
10514 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10515 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10516 long ret_ref = (long)ret_var.inner;
10517 if (ret_var.is_owned) {
10523 uint32_t UnsignedNodeAnnouncement_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
10524 LDKUnsignedNodeAnnouncement this_ptr_conv;
10525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10526 this_ptr_conv.is_owned = false;
10527 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
10528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10530 long ret_ref = (long)ret_var.inner;
10531 if (ret_var.is_owned) {
10537 void UnsignedNodeAnnouncement_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10538 LDKUnsignedNodeAnnouncement this_ptr_conv;
10539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10540 this_ptr_conv.is_owned = false;
10541 LDKNodeFeatures val_conv;
10542 val_conv.inner = (void*)(val & (~1));
10543 val_conv.is_owned = (val & 1) || (val == 0);
10544 // Warning: we may need a move here but can't clone!
10545 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
10548 int32_t UnsignedNodeAnnouncement_1get_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
10549 LDKUnsignedNodeAnnouncement this_ptr_conv;
10550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10551 this_ptr_conv.is_owned = false;
10552 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
10556 void UnsignedNodeAnnouncement_1set_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
10557 LDKUnsignedNodeAnnouncement this_ptr_conv;
10558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10559 this_ptr_conv.is_owned = false;
10560 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
10563 int8_tArray UnsignedNodeAnnouncement_1get_1node_1id(void* ctx_TODO, uint32_t this_ptr) {
10564 LDKUnsignedNodeAnnouncement this_ptr_conv;
10565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10566 this_ptr_conv.is_owned = false;
10567 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10568 memcpy(arg_arr.len + 1, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
10572 void UnsignedNodeAnnouncement_1set_1node_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10573 LDKUnsignedNodeAnnouncement this_ptr_conv;
10574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10575 this_ptr_conv.is_owned = false;
10576 LDKPublicKey val_ref;
10577 CHECK(*val.len == 33);
10578 memcpy(val_ref.compressed_form, val.len + 1, 33);
10579 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
10582 int8_tArray UnsignedNodeAnnouncement_1get_1rgb(void* ctx_TODO, uint32_t this_ptr) {
10583 LDKUnsignedNodeAnnouncement this_ptr_conv;
10584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10585 this_ptr_conv.is_owned = false;
10586 int8_tArray ret_arr = { .len = MALLOC(3 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10587 memcpy(ret_arr.len + 1, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
10591 void UnsignedNodeAnnouncement_1set_1rgb(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10592 LDKUnsignedNodeAnnouncement this_ptr_conv;
10593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10594 this_ptr_conv.is_owned = false;
10595 LDKThreeBytes val_ref;
10596 CHECK(*val.len == 3);
10597 memcpy(val_ref.data, val.len + 1, 3);
10598 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
10601 int8_tArray UnsignedNodeAnnouncement_1get_1alias(void* ctx_TODO, uint32_t this_ptr) {
10602 LDKUnsignedNodeAnnouncement this_ptr_conv;
10603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10604 this_ptr_conv.is_owned = false;
10605 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10606 memcpy(ret_arr.len + 1, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
10610 void UnsignedNodeAnnouncement_1set_1alias(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10611 LDKUnsignedNodeAnnouncement this_ptr_conv;
10612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10613 this_ptr_conv.is_owned = false;
10614 LDKThirtyTwoBytes val_ref;
10615 CHECK(*val.len == 32);
10616 memcpy(val_ref.data, val.len + 1, 32);
10617 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
10620 void UnsignedNodeAnnouncement_1set_1addresses(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
10621 LDKUnsignedNodeAnnouncement this_ptr_conv;
10622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10623 this_ptr_conv.is_owned = false;
10624 LDKCVec_NetAddressZ val_constr;
10625 val_constr.datalen = *val.len;
10626 if (val_constr.datalen > 0)
10627 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10629 val_constr.data = NULL;
10630 uint32_t* val_vals = (uint32_t*)(val.len + 1);
10631 for (size_t m = 0; m < val_constr.datalen; m++) {
10632 uint32_t arr_conv_12 = val_vals[m];
10633 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
10634 FREE((void*)arr_conv_12);
10635 val_constr.data[m] = arr_conv_12_conv;
10637 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
10640 void NodeAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10641 LDKNodeAnnouncement this_ptr_conv;
10642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10644 NodeAnnouncement_free(this_ptr_conv);
10647 uint32_t NodeAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10648 LDKNodeAnnouncement orig_conv;
10649 orig_conv.inner = (void*)(orig & (~1));
10650 orig_conv.is_owned = false;
10651 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
10652 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10653 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10654 long ret_ref = (long)ret_var.inner;
10655 if (ret_var.is_owned) {
10661 int8_tArray NodeAnnouncement_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
10662 LDKNodeAnnouncement this_ptr_conv;
10663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10664 this_ptr_conv.is_owned = false;
10665 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10666 memcpy(arg_arr.len + 1, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
10670 void NodeAnnouncement_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10671 LDKNodeAnnouncement this_ptr_conv;
10672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10673 this_ptr_conv.is_owned = false;
10674 LDKSignature val_ref;
10675 CHECK(*val.len == 64);
10676 memcpy(val_ref.compact_form, val.len + 1, 64);
10677 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
10680 uint32_t NodeAnnouncement_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
10681 LDKNodeAnnouncement this_ptr_conv;
10682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10683 this_ptr_conv.is_owned = false;
10684 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
10685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10687 long ret_ref = (long)ret_var.inner;
10688 if (ret_var.is_owned) {
10694 void NodeAnnouncement_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10695 LDKNodeAnnouncement this_ptr_conv;
10696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10697 this_ptr_conv.is_owned = false;
10698 LDKUnsignedNodeAnnouncement val_conv;
10699 val_conv.inner = (void*)(val & (~1));
10700 val_conv.is_owned = (val & 1) || (val == 0);
10701 if (val_conv.inner != NULL)
10702 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
10703 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
10706 uint32_t NodeAnnouncement_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
10707 LDKSignature signature_arg_ref;
10708 CHECK(*signature_arg.len == 64);
10709 memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
10710 LDKUnsignedNodeAnnouncement contents_arg_conv;
10711 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10712 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10713 if (contents_arg_conv.inner != NULL)
10714 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
10715 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
10716 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10717 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10718 long ret_ref = (long)ret_var.inner;
10719 if (ret_var.is_owned) {
10725 void UnsignedChannelAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10726 LDKUnsignedChannelAnnouncement this_ptr_conv;
10727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10729 UnsignedChannelAnnouncement_free(this_ptr_conv);
10732 uint32_t UnsignedChannelAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10733 LDKUnsignedChannelAnnouncement orig_conv;
10734 orig_conv.inner = (void*)(orig & (~1));
10735 orig_conv.is_owned = false;
10736 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10737 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10738 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10739 long ret_ref = (long)ret_var.inner;
10740 if (ret_var.is_owned) {
10746 uint32_t UnsignedChannelAnnouncement_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
10747 LDKUnsignedChannelAnnouncement this_ptr_conv;
10748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10749 this_ptr_conv.is_owned = false;
10750 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10751 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10752 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10753 long ret_ref = (long)ret_var.inner;
10754 if (ret_var.is_owned) {
10760 void UnsignedChannelAnnouncement_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10761 LDKUnsignedChannelAnnouncement this_ptr_conv;
10762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10763 this_ptr_conv.is_owned = false;
10764 LDKChannelFeatures val_conv;
10765 val_conv.inner = (void*)(val & (~1));
10766 val_conv.is_owned = (val & 1) || (val == 0);
10767 // Warning: we may need a move here but can't clone!
10768 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10771 int8_tArray UnsignedChannelAnnouncement_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
10772 LDKUnsignedChannelAnnouncement this_ptr_conv;
10773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10774 this_ptr_conv.is_owned = false;
10775 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10776 memcpy(ret_arr.len + 1, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
10780 void UnsignedChannelAnnouncement_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10781 LDKUnsignedChannelAnnouncement this_ptr_conv;
10782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10783 this_ptr_conv.is_owned = false;
10784 LDKThirtyTwoBytes val_ref;
10785 CHECK(*val.len == 32);
10786 memcpy(val_ref.data, val.len + 1, 32);
10787 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10790 int64_t UnsignedChannelAnnouncement_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
10791 LDKUnsignedChannelAnnouncement this_ptr_conv;
10792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10793 this_ptr_conv.is_owned = false;
10794 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10798 void UnsignedChannelAnnouncement_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
10799 LDKUnsignedChannelAnnouncement this_ptr_conv;
10800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10801 this_ptr_conv.is_owned = false;
10802 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10805 int8_tArray UnsignedChannelAnnouncement_1get_1node_1id_11(void* ctx_TODO, uint32_t this_ptr) {
10806 LDKUnsignedChannelAnnouncement this_ptr_conv;
10807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10808 this_ptr_conv.is_owned = false;
10809 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10810 memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
10814 void UnsignedChannelAnnouncement_1set_1node_1id_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10815 LDKUnsignedChannelAnnouncement this_ptr_conv;
10816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10817 this_ptr_conv.is_owned = false;
10818 LDKPublicKey val_ref;
10819 CHECK(*val.len == 33);
10820 memcpy(val_ref.compressed_form, val.len + 1, 33);
10821 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10824 int8_tArray UnsignedChannelAnnouncement_1get_1node_1id_12(void* ctx_TODO, uint32_t this_ptr) {
10825 LDKUnsignedChannelAnnouncement this_ptr_conv;
10826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10827 this_ptr_conv.is_owned = false;
10828 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10829 memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
10833 void UnsignedChannelAnnouncement_1set_1node_1id_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10834 LDKUnsignedChannelAnnouncement this_ptr_conv;
10835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10836 this_ptr_conv.is_owned = false;
10837 LDKPublicKey val_ref;
10838 CHECK(*val.len == 33);
10839 memcpy(val_ref.compressed_form, val.len + 1, 33);
10840 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10843 int8_tArray UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(void* ctx_TODO, uint32_t this_ptr) {
10844 LDKUnsignedChannelAnnouncement this_ptr_conv;
10845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10846 this_ptr_conv.is_owned = false;
10847 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10848 memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
10852 void UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10853 LDKUnsignedChannelAnnouncement this_ptr_conv;
10854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10855 this_ptr_conv.is_owned = false;
10856 LDKPublicKey val_ref;
10857 CHECK(*val.len == 33);
10858 memcpy(val_ref.compressed_form, val.len + 1, 33);
10859 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10862 int8_tArray UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(void* ctx_TODO, uint32_t this_ptr) {
10863 LDKUnsignedChannelAnnouncement this_ptr_conv;
10864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10865 this_ptr_conv.is_owned = false;
10866 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10867 memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
10871 void UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10872 LDKUnsignedChannelAnnouncement this_ptr_conv;
10873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10874 this_ptr_conv.is_owned = false;
10875 LDKPublicKey val_ref;
10876 CHECK(*val.len == 33);
10877 memcpy(val_ref.compressed_form, val.len + 1, 33);
10878 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10881 void ChannelAnnouncement_1free(void* ctx_TODO, uint32_t this_ptr) {
10882 LDKChannelAnnouncement this_ptr_conv;
10883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10885 ChannelAnnouncement_free(this_ptr_conv);
10888 uint32_t ChannelAnnouncement_1clone(void* ctx_TODO, uint32_t orig) {
10889 LDKChannelAnnouncement orig_conv;
10890 orig_conv.inner = (void*)(orig & (~1));
10891 orig_conv.is_owned = false;
10892 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10893 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10894 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10895 long ret_ref = (long)ret_var.inner;
10896 if (ret_var.is_owned) {
10902 int8_tArray ChannelAnnouncement_1get_1node_1signature_11(void* ctx_TODO, uint32_t this_ptr) {
10903 LDKChannelAnnouncement this_ptr_conv;
10904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10905 this_ptr_conv.is_owned = false;
10906 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10907 memcpy(arg_arr.len + 1, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
10911 void ChannelAnnouncement_1set_1node_1signature_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10912 LDKChannelAnnouncement this_ptr_conv;
10913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10914 this_ptr_conv.is_owned = false;
10915 LDKSignature val_ref;
10916 CHECK(*val.len == 64);
10917 memcpy(val_ref.compact_form, val.len + 1, 64);
10918 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10921 int8_tArray ChannelAnnouncement_1get_1node_1signature_12(void* ctx_TODO, uint32_t this_ptr) {
10922 LDKChannelAnnouncement this_ptr_conv;
10923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10924 this_ptr_conv.is_owned = false;
10925 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10926 memcpy(arg_arr.len + 1, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
10930 void ChannelAnnouncement_1set_1node_1signature_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10931 LDKChannelAnnouncement this_ptr_conv;
10932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10933 this_ptr_conv.is_owned = false;
10934 LDKSignature val_ref;
10935 CHECK(*val.len == 64);
10936 memcpy(val_ref.compact_form, val.len + 1, 64);
10937 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10940 int8_tArray ChannelAnnouncement_1get_1bitcoin_1signature_11(void* ctx_TODO, uint32_t this_ptr) {
10941 LDKChannelAnnouncement this_ptr_conv;
10942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10943 this_ptr_conv.is_owned = false;
10944 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10945 memcpy(arg_arr.len + 1, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
10949 void ChannelAnnouncement_1set_1bitcoin_1signature_11(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10950 LDKChannelAnnouncement this_ptr_conv;
10951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10952 this_ptr_conv.is_owned = false;
10953 LDKSignature val_ref;
10954 CHECK(*val.len == 64);
10955 memcpy(val_ref.compact_form, val.len + 1, 64);
10956 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10959 int8_tArray ChannelAnnouncement_1get_1bitcoin_1signature_12(void* ctx_TODO, uint32_t this_ptr) {
10960 LDKChannelAnnouncement this_ptr_conv;
10961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10962 this_ptr_conv.is_owned = false;
10963 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
10964 memcpy(arg_arr.len + 1, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
10968 void ChannelAnnouncement_1set_1bitcoin_1signature_12(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
10969 LDKChannelAnnouncement this_ptr_conv;
10970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10971 this_ptr_conv.is_owned = false;
10972 LDKSignature val_ref;
10973 CHECK(*val.len == 64);
10974 memcpy(val_ref.compact_form, val.len + 1, 64);
10975 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10978 uint32_t ChannelAnnouncement_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
10979 LDKChannelAnnouncement this_ptr_conv;
10980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10981 this_ptr_conv.is_owned = false;
10982 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10983 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10984 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10985 long ret_ref = (long)ret_var.inner;
10986 if (ret_var.is_owned) {
10992 void ChannelAnnouncement_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
10993 LDKChannelAnnouncement this_ptr_conv;
10994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10995 this_ptr_conv.is_owned = false;
10996 LDKUnsignedChannelAnnouncement val_conv;
10997 val_conv.inner = (void*)(val & (~1));
10998 val_conv.is_owned = (val & 1) || (val == 0);
10999 if (val_conv.inner != NULL)
11000 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
11001 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
11004 uint32_t ChannelAnnouncement_1new(void* ctx_TODO, int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, uint32_t contents_arg) {
11005 LDKSignature node_signature_1_arg_ref;
11006 CHECK(*node_signature_1_arg.len == 64);
11007 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg.len + 1, 64);
11008 LDKSignature node_signature_2_arg_ref;
11009 CHECK(*node_signature_2_arg.len == 64);
11010 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg.len + 1, 64);
11011 LDKSignature bitcoin_signature_1_arg_ref;
11012 CHECK(*bitcoin_signature_1_arg.len == 64);
11013 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg.len + 1, 64);
11014 LDKSignature bitcoin_signature_2_arg_ref;
11015 CHECK(*bitcoin_signature_2_arg.len == 64);
11016 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg.len + 1, 64);
11017 LDKUnsignedChannelAnnouncement contents_arg_conv;
11018 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11019 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11020 if (contents_arg_conv.inner != NULL)
11021 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
11022 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);
11023 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11024 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11025 long ret_ref = (long)ret_var.inner;
11026 if (ret_var.is_owned) {
11032 void UnsignedChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
11033 LDKUnsignedChannelUpdate this_ptr_conv;
11034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11035 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11036 UnsignedChannelUpdate_free(this_ptr_conv);
11039 uint32_t UnsignedChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
11040 LDKUnsignedChannelUpdate orig_conv;
11041 orig_conv.inner = (void*)(orig & (~1));
11042 orig_conv.is_owned = false;
11043 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
11044 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11045 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11046 long ret_ref = (long)ret_var.inner;
11047 if (ret_var.is_owned) {
11053 int8_tArray UnsignedChannelUpdate_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11054 LDKUnsignedChannelUpdate this_ptr_conv;
11055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11056 this_ptr_conv.is_owned = false;
11057 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
11058 memcpy(ret_arr.len + 1, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
11062 void UnsignedChannelUpdate_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11063 LDKUnsignedChannelUpdate this_ptr_conv;
11064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11065 this_ptr_conv.is_owned = false;
11066 LDKThirtyTwoBytes val_ref;
11067 CHECK(*val.len == 32);
11068 memcpy(val_ref.data, val.len + 1, 32);
11069 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
11072 int64_t UnsignedChannelUpdate_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
11073 LDKUnsignedChannelUpdate this_ptr_conv;
11074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11075 this_ptr_conv.is_owned = false;
11076 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
11080 void UnsignedChannelUpdate_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
11081 LDKUnsignedChannelUpdate this_ptr_conv;
11082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11083 this_ptr_conv.is_owned = false;
11084 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
11087 int32_t UnsignedChannelUpdate_1get_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
11088 LDKUnsignedChannelUpdate this_ptr_conv;
11089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11090 this_ptr_conv.is_owned = false;
11091 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
11095 void UnsignedChannelUpdate_1set_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11096 LDKUnsignedChannelUpdate this_ptr_conv;
11097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11098 this_ptr_conv.is_owned = false;
11099 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
11102 int8_t UnsignedChannelUpdate_1get_1flags(void* ctx_TODO, uint32_t this_ptr) {
11103 LDKUnsignedChannelUpdate this_ptr_conv;
11104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11105 this_ptr_conv.is_owned = false;
11106 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
11110 void UnsignedChannelUpdate_1set_1flags(void* ctx_TODO, uint32_t this_ptr, int8_t val) {
11111 LDKUnsignedChannelUpdate this_ptr_conv;
11112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11113 this_ptr_conv.is_owned = false;
11114 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
11117 int16_t UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
11118 LDKUnsignedChannelUpdate this_ptr_conv;
11119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11120 this_ptr_conv.is_owned = false;
11121 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
11125 void UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
11126 LDKUnsignedChannelUpdate this_ptr_conv;
11127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11128 this_ptr_conv.is_owned = false;
11129 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
11132 int64_t UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
11133 LDKUnsignedChannelUpdate this_ptr_conv;
11134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11135 this_ptr_conv.is_owned = false;
11136 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
11140 void UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
11141 LDKUnsignedChannelUpdate this_ptr_conv;
11142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11143 this_ptr_conv.is_owned = false;
11144 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
11147 int32_t UnsignedChannelUpdate_1get_1fee_1base_1msat(void* ctx_TODO, uint32_t this_ptr) {
11148 LDKUnsignedChannelUpdate this_ptr_conv;
11149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11150 this_ptr_conv.is_owned = false;
11151 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
11155 void UnsignedChannelUpdate_1set_1fee_1base_1msat(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11156 LDKUnsignedChannelUpdate this_ptr_conv;
11157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11158 this_ptr_conv.is_owned = false;
11159 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
11162 int32_t UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
11163 LDKUnsignedChannelUpdate this_ptr_conv;
11164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11165 this_ptr_conv.is_owned = false;
11166 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
11170 void UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11171 LDKUnsignedChannelUpdate this_ptr_conv;
11172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11173 this_ptr_conv.is_owned = false;
11174 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
11177 void ChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
11178 LDKChannelUpdate this_ptr_conv;
11179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11181 ChannelUpdate_free(this_ptr_conv);
11184 uint32_t ChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
11185 LDKChannelUpdate orig_conv;
11186 orig_conv.inner = (void*)(orig & (~1));
11187 orig_conv.is_owned = false;
11188 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
11189 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11190 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11191 long ret_ref = (long)ret_var.inner;
11192 if (ret_var.is_owned) {
11198 int8_tArray ChannelUpdate_1get_1signature(void* ctx_TODO, uint32_t this_ptr) {
11199 LDKChannelUpdate this_ptr_conv;
11200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11201 this_ptr_conv.is_owned = false;
11202 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
11203 memcpy(arg_arr.len + 1, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
11207 void ChannelUpdate_1set_1signature(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11208 LDKChannelUpdate this_ptr_conv;
11209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11210 this_ptr_conv.is_owned = false;
11211 LDKSignature val_ref;
11212 CHECK(*val.len == 64);
11213 memcpy(val_ref.compact_form, val.len + 1, 64);
11214 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
11217 uint32_t ChannelUpdate_1get_1contents(void* ctx_TODO, uint32_t this_ptr) {
11218 LDKChannelUpdate this_ptr_conv;
11219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11220 this_ptr_conv.is_owned = false;
11221 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
11222 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11223 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11224 long ret_ref = (long)ret_var.inner;
11225 if (ret_var.is_owned) {
11231 void ChannelUpdate_1set_1contents(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11232 LDKChannelUpdate this_ptr_conv;
11233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11234 this_ptr_conv.is_owned = false;
11235 LDKUnsignedChannelUpdate val_conv;
11236 val_conv.inner = (void*)(val & (~1));
11237 val_conv.is_owned = (val & 1) || (val == 0);
11238 if (val_conv.inner != NULL)
11239 val_conv = UnsignedChannelUpdate_clone(&val_conv);
11240 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
11243 uint32_t ChannelUpdate_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
11244 LDKSignature signature_arg_ref;
11245 CHECK(*signature_arg.len == 64);
11246 memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
11247 LDKUnsignedChannelUpdate contents_arg_conv;
11248 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11249 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11250 if (contents_arg_conv.inner != NULL)
11251 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
11252 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
11253 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11254 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11255 long ret_ref = (long)ret_var.inner;
11256 if (ret_var.is_owned) {
11262 void QueryChannelRange_1free(void* ctx_TODO, uint32_t this_ptr) {
11263 LDKQueryChannelRange this_ptr_conv;
11264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11266 QueryChannelRange_free(this_ptr_conv);
11269 uint32_t QueryChannelRange_1clone(void* ctx_TODO, uint32_t orig) {
11270 LDKQueryChannelRange orig_conv;
11271 orig_conv.inner = (void*)(orig & (~1));
11272 orig_conv.is_owned = false;
11273 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
11274 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11275 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11276 long ret_ref = (long)ret_var.inner;
11277 if (ret_var.is_owned) {
11283 int8_tArray QueryChannelRange_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11284 LDKQueryChannelRange this_ptr_conv;
11285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11286 this_ptr_conv.is_owned = false;
11287 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
11288 memcpy(ret_arr.len + 1, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
11292 void QueryChannelRange_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11293 LDKQueryChannelRange this_ptr_conv;
11294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11295 this_ptr_conv.is_owned = false;
11296 LDKThirtyTwoBytes val_ref;
11297 CHECK(*val.len == 32);
11298 memcpy(val_ref.data, val.len + 1, 32);
11299 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
11302 int32_t QueryChannelRange_1get_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr) {
11303 LDKQueryChannelRange this_ptr_conv;
11304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11305 this_ptr_conv.is_owned = false;
11306 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
11310 void QueryChannelRange_1set_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11311 LDKQueryChannelRange this_ptr_conv;
11312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11313 this_ptr_conv.is_owned = false;
11314 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
11317 int32_t QueryChannelRange_1get_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr) {
11318 LDKQueryChannelRange this_ptr_conv;
11319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11320 this_ptr_conv.is_owned = false;
11321 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
11325 void QueryChannelRange_1set_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11326 LDKQueryChannelRange this_ptr_conv;
11327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11328 this_ptr_conv.is_owned = false;
11329 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
11332 uint32_t QueryChannelRange_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
11333 LDKThirtyTwoBytes chain_hash_arg_ref;
11334 CHECK(*chain_hash_arg.len == 32);
11335 memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
11336 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
11337 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11338 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11339 long ret_ref = (long)ret_var.inner;
11340 if (ret_var.is_owned) {
11346 void ReplyChannelRange_1free(void* ctx_TODO, uint32_t this_ptr) {
11347 LDKReplyChannelRange this_ptr_conv;
11348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11350 ReplyChannelRange_free(this_ptr_conv);
11353 uint32_t ReplyChannelRange_1clone(void* ctx_TODO, uint32_t orig) {
11354 LDKReplyChannelRange orig_conv;
11355 orig_conv.inner = (void*)(orig & (~1));
11356 orig_conv.is_owned = false;
11357 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
11358 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11359 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11360 long ret_ref = (long)ret_var.inner;
11361 if (ret_var.is_owned) {
11367 int8_tArray ReplyChannelRange_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11368 LDKReplyChannelRange this_ptr_conv;
11369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11370 this_ptr_conv.is_owned = false;
11371 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
11372 memcpy(ret_arr.len + 1, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
11376 void ReplyChannelRange_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11377 LDKReplyChannelRange this_ptr_conv;
11378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11379 this_ptr_conv.is_owned = false;
11380 LDKThirtyTwoBytes val_ref;
11381 CHECK(*val.len == 32);
11382 memcpy(val_ref.data, val.len + 1, 32);
11383 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
11386 int32_t ReplyChannelRange_1get_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr) {
11387 LDKReplyChannelRange this_ptr_conv;
11388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11389 this_ptr_conv.is_owned = false;
11390 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
11394 void ReplyChannelRange_1set_1first_1blocknum(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11395 LDKReplyChannelRange this_ptr_conv;
11396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11397 this_ptr_conv.is_owned = false;
11398 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
11401 int32_t ReplyChannelRange_1get_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr) {
11402 LDKReplyChannelRange this_ptr_conv;
11403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11404 this_ptr_conv.is_owned = false;
11405 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
11409 void ReplyChannelRange_1set_1number_1of_1blocks(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11410 LDKReplyChannelRange this_ptr_conv;
11411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11412 this_ptr_conv.is_owned = false;
11413 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
11416 jboolean ReplyChannelRange_1get_1full_1information(void* ctx_TODO, uint32_t this_ptr) {
11417 LDKReplyChannelRange this_ptr_conv;
11418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11419 this_ptr_conv.is_owned = false;
11420 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
11424 void ReplyChannelRange_1set_1full_1information(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
11425 LDKReplyChannelRange this_ptr_conv;
11426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11427 this_ptr_conv.is_owned = false;
11428 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
11431 void ReplyChannelRange_1set_1short_1channel_1ids(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
11432 LDKReplyChannelRange this_ptr_conv;
11433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11434 this_ptr_conv.is_owned = false;
11435 LDKCVec_u64Z val_constr;
11436 val_constr.datalen = *val.len;
11437 if (val_constr.datalen > 0)
11438 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11440 val_constr.data = NULL;
11441 int64_t* val_vals = (int64_t*)(val.len + 1);
11442 for (size_t i = 0; i < val_constr.datalen; i++) {
11443 int64_t arr_conv_8 = val_vals[i];
11444 val_constr.data[i] = arr_conv_8;
11446 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
11449 uint32_t ReplyChannelRange_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean full_information_arg, int64_tArray short_channel_ids_arg) {
11450 LDKThirtyTwoBytes chain_hash_arg_ref;
11451 CHECK(*chain_hash_arg.len == 32);
11452 memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
11453 LDKCVec_u64Z short_channel_ids_arg_constr;
11454 short_channel_ids_arg_constr.datalen = *short_channel_ids_arg.len;
11455 if (short_channel_ids_arg_constr.datalen > 0)
11456 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11458 short_channel_ids_arg_constr.data = NULL;
11459 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg.len + 1);
11460 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
11461 int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
11462 short_channel_ids_arg_constr.data[i] = arr_conv_8;
11464 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
11465 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11466 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11467 long ret_ref = (long)ret_var.inner;
11468 if (ret_var.is_owned) {
11474 void QueryShortChannelIds_1free(void* ctx_TODO, uint32_t this_ptr) {
11475 LDKQueryShortChannelIds this_ptr_conv;
11476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11478 QueryShortChannelIds_free(this_ptr_conv);
11481 uint32_t QueryShortChannelIds_1clone(void* ctx_TODO, uint32_t orig) {
11482 LDKQueryShortChannelIds orig_conv;
11483 orig_conv.inner = (void*)(orig & (~1));
11484 orig_conv.is_owned = false;
11485 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
11486 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11487 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11488 long ret_ref = (long)ret_var.inner;
11489 if (ret_var.is_owned) {
11495 int8_tArray QueryShortChannelIds_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11496 LDKQueryShortChannelIds this_ptr_conv;
11497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11498 this_ptr_conv.is_owned = false;
11499 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
11500 memcpy(ret_arr.len + 1, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
11504 void QueryShortChannelIds_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11505 LDKQueryShortChannelIds this_ptr_conv;
11506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11507 this_ptr_conv.is_owned = false;
11508 LDKThirtyTwoBytes val_ref;
11509 CHECK(*val.len == 32);
11510 memcpy(val_ref.data, val.len + 1, 32);
11511 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
11514 void QueryShortChannelIds_1set_1short_1channel_1ids(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
11515 LDKQueryShortChannelIds this_ptr_conv;
11516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11517 this_ptr_conv.is_owned = false;
11518 LDKCVec_u64Z val_constr;
11519 val_constr.datalen = *val.len;
11520 if (val_constr.datalen > 0)
11521 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11523 val_constr.data = NULL;
11524 int64_t* val_vals = (int64_t*)(val.len + 1);
11525 for (size_t i = 0; i < val_constr.datalen; i++) {
11526 int64_t arr_conv_8 = val_vals[i];
11527 val_constr.data[i] = arr_conv_8;
11529 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
11532 uint32_t QueryShortChannelIds_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
11533 LDKThirtyTwoBytes chain_hash_arg_ref;
11534 CHECK(*chain_hash_arg.len == 32);
11535 memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
11536 LDKCVec_u64Z short_channel_ids_arg_constr;
11537 short_channel_ids_arg_constr.datalen = *short_channel_ids_arg.len;
11538 if (short_channel_ids_arg_constr.datalen > 0)
11539 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11541 short_channel_ids_arg_constr.data = NULL;
11542 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg.len + 1);
11543 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
11544 int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
11545 short_channel_ids_arg_constr.data[i] = arr_conv_8;
11547 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
11548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11550 long ret_ref = (long)ret_var.inner;
11551 if (ret_var.is_owned) {
11557 void ReplyShortChannelIdsEnd_1free(void* ctx_TODO, uint32_t this_ptr) {
11558 LDKReplyShortChannelIdsEnd this_ptr_conv;
11559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11561 ReplyShortChannelIdsEnd_free(this_ptr_conv);
11564 uint32_t ReplyShortChannelIdsEnd_1clone(void* ctx_TODO, uint32_t orig) {
11565 LDKReplyShortChannelIdsEnd orig_conv;
11566 orig_conv.inner = (void*)(orig & (~1));
11567 orig_conv.is_owned = false;
11568 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
11569 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11570 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11571 long ret_ref = (long)ret_var.inner;
11572 if (ret_var.is_owned) {
11578 int8_tArray ReplyShortChannelIdsEnd_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11579 LDKReplyShortChannelIdsEnd this_ptr_conv;
11580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11581 this_ptr_conv.is_owned = false;
11582 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
11583 memcpy(ret_arr.len + 1, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
11587 void ReplyShortChannelIdsEnd_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11588 LDKReplyShortChannelIdsEnd this_ptr_conv;
11589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11590 this_ptr_conv.is_owned = false;
11591 LDKThirtyTwoBytes val_ref;
11592 CHECK(*val.len == 32);
11593 memcpy(val_ref.data, val.len + 1, 32);
11594 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
11597 jboolean ReplyShortChannelIdsEnd_1get_1full_1information(void* ctx_TODO, uint32_t this_ptr) {
11598 LDKReplyShortChannelIdsEnd this_ptr_conv;
11599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11600 this_ptr_conv.is_owned = false;
11601 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
11605 void ReplyShortChannelIdsEnd_1set_1full_1information(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
11606 LDKReplyShortChannelIdsEnd this_ptr_conv;
11607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11608 this_ptr_conv.is_owned = false;
11609 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
11612 uint32_t ReplyShortChannelIdsEnd_1new(void* ctx_TODO, int8_tArray chain_hash_arg, jboolean full_information_arg) {
11613 LDKThirtyTwoBytes chain_hash_arg_ref;
11614 CHECK(*chain_hash_arg.len == 32);
11615 memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
11616 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
11617 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11618 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11619 long ret_ref = (long)ret_var.inner;
11620 if (ret_var.is_owned) {
11626 void GossipTimestampFilter_1free(void* ctx_TODO, uint32_t this_ptr) {
11627 LDKGossipTimestampFilter this_ptr_conv;
11628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11630 GossipTimestampFilter_free(this_ptr_conv);
11633 uint32_t GossipTimestampFilter_1clone(void* ctx_TODO, uint32_t orig) {
11634 LDKGossipTimestampFilter orig_conv;
11635 orig_conv.inner = (void*)(orig & (~1));
11636 orig_conv.is_owned = false;
11637 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
11638 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11639 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11640 long ret_ref = (long)ret_var.inner;
11641 if (ret_var.is_owned) {
11647 int8_tArray GossipTimestampFilter_1get_1chain_1hash(void* ctx_TODO, uint32_t this_ptr) {
11648 LDKGossipTimestampFilter this_ptr_conv;
11649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11650 this_ptr_conv.is_owned = false;
11651 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
11652 memcpy(ret_arr.len + 1, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
11656 void GossipTimestampFilter_1set_1chain_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11657 LDKGossipTimestampFilter this_ptr_conv;
11658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11659 this_ptr_conv.is_owned = false;
11660 LDKThirtyTwoBytes val_ref;
11661 CHECK(*val.len == 32);
11662 memcpy(val_ref.data, val.len + 1, 32);
11663 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
11666 int32_t GossipTimestampFilter_1get_1first_1timestamp(void* ctx_TODO, uint32_t this_ptr) {
11667 LDKGossipTimestampFilter this_ptr_conv;
11668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11669 this_ptr_conv.is_owned = false;
11670 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
11674 void GossipTimestampFilter_1set_1first_1timestamp(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11675 LDKGossipTimestampFilter this_ptr_conv;
11676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11677 this_ptr_conv.is_owned = false;
11678 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
11681 int32_t GossipTimestampFilter_1get_1timestamp_1range(void* ctx_TODO, uint32_t this_ptr) {
11682 LDKGossipTimestampFilter this_ptr_conv;
11683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11684 this_ptr_conv.is_owned = false;
11685 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
11689 void GossipTimestampFilter_1set_1timestamp_1range(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
11690 LDKGossipTimestampFilter this_ptr_conv;
11691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11692 this_ptr_conv.is_owned = false;
11693 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
11696 uint32_t GossipTimestampFilter_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
11697 LDKThirtyTwoBytes chain_hash_arg_ref;
11698 CHECK(*chain_hash_arg.len == 32);
11699 memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
11700 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
11701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11703 long ret_ref = (long)ret_var.inner;
11704 if (ret_var.is_owned) {
11710 void ErrorAction_1free(void* ctx_TODO, uint32_t this_ptr) {
11711 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
11712 FREE((void*)this_ptr);
11713 ErrorAction_free(this_ptr_conv);
11716 uint32_t ErrorAction_1clone(void* ctx_TODO, uint32_t orig) {
11717 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
11718 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11719 *ret_copy = ErrorAction_clone(orig_conv);
11720 long ret_ref = (long)ret_copy;
11724 void LightningError_1free(void* ctx_TODO, uint32_t this_ptr) {
11725 LDKLightningError this_ptr_conv;
11726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11728 LightningError_free(this_ptr_conv);
11731 jstring LightningError_1get_1err(void* ctx_TODO, uint32_t this_ptr) {
11732 LDKLightningError this_ptr_conv;
11733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11734 this_ptr_conv.is_owned = false;
11735 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11736 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11737 memcpy(_buf, _str.chars, _str.len);
11738 _buf[_str.len] = 0;
11739 jstring _conv = conv_owned_string(_str.chars);
11744 void LightningError_1set_1err(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
11745 LDKLightningError this_ptr_conv;
11746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11747 this_ptr_conv.is_owned = false;
11748 LDKCVec_u8Z val_ref;
11749 val_ref.datalen = *val.len;
11750 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11751 memcpy(val_ref.data, val.len + 1, val_ref.datalen);
11752 LightningError_set_err(&this_ptr_conv, val_ref);
11755 uint32_t LightningError_1get_1action(void* ctx_TODO, uint32_t this_ptr) {
11756 LDKLightningError this_ptr_conv;
11757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11758 this_ptr_conv.is_owned = false;
11759 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11760 *ret_copy = LightningError_get_action(&this_ptr_conv);
11761 long ret_ref = (long)ret_copy;
11765 void LightningError_1set_1action(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11766 LDKLightningError this_ptr_conv;
11767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11768 this_ptr_conv.is_owned = false;
11769 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11771 LightningError_set_action(&this_ptr_conv, val_conv);
11774 uint32_t LightningError_1new(void* ctx_TODO, int8_tArray err_arg, uint32_t action_arg) {
11775 LDKCVec_u8Z err_arg_ref;
11776 err_arg_ref.datalen = *err_arg.len;
11777 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11778 memcpy(err_arg_ref.data, err_arg.len + 1, err_arg_ref.datalen);
11779 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11780 FREE((void*)action_arg);
11781 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11782 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11783 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11784 long ret_ref = (long)ret_var.inner;
11785 if (ret_var.is_owned) {
11791 void CommitmentUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
11792 LDKCommitmentUpdate this_ptr_conv;
11793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11794 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11795 CommitmentUpdate_free(this_ptr_conv);
11798 uint32_t CommitmentUpdate_1clone(void* ctx_TODO, uint32_t orig) {
11799 LDKCommitmentUpdate orig_conv;
11800 orig_conv.inner = (void*)(orig & (~1));
11801 orig_conv.is_owned = false;
11802 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11803 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11804 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11805 long ret_ref = (long)ret_var.inner;
11806 if (ret_var.is_owned) {
11812 void CommitmentUpdate_1set_1update_1add_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11813 LDKCommitmentUpdate this_ptr_conv;
11814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11815 this_ptr_conv.is_owned = false;
11816 LDKCVec_UpdateAddHTLCZ val_constr;
11817 val_constr.datalen = *val.len;
11818 if (val_constr.datalen > 0)
11819 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11821 val_constr.data = NULL;
11822 uint32_t* val_vals = (uint32_t*)(val.len + 1);
11823 for (size_t p = 0; p < val_constr.datalen; p++) {
11824 uint32_t arr_conv_15 = val_vals[p];
11825 LDKUpdateAddHTLC arr_conv_15_conv;
11826 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11827 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11828 if (arr_conv_15_conv.inner != NULL)
11829 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11830 val_constr.data[p] = arr_conv_15_conv;
11832 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11835 void CommitmentUpdate_1set_1update_1fulfill_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11836 LDKCommitmentUpdate this_ptr_conv;
11837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11838 this_ptr_conv.is_owned = false;
11839 LDKCVec_UpdateFulfillHTLCZ val_constr;
11840 val_constr.datalen = *val.len;
11841 if (val_constr.datalen > 0)
11842 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11844 val_constr.data = NULL;
11845 uint32_t* val_vals = (uint32_t*)(val.len + 1);
11846 for (size_t t = 0; t < val_constr.datalen; t++) {
11847 uint32_t arr_conv_19 = val_vals[t];
11848 LDKUpdateFulfillHTLC arr_conv_19_conv;
11849 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11850 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11851 if (arr_conv_19_conv.inner != NULL)
11852 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11853 val_constr.data[t] = arr_conv_19_conv;
11855 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11858 void CommitmentUpdate_1set_1update_1fail_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11859 LDKCommitmentUpdate this_ptr_conv;
11860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11861 this_ptr_conv.is_owned = false;
11862 LDKCVec_UpdateFailHTLCZ val_constr;
11863 val_constr.datalen = *val.len;
11864 if (val_constr.datalen > 0)
11865 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11867 val_constr.data = NULL;
11868 uint32_t* val_vals = (uint32_t*)(val.len + 1);
11869 for (size_t q = 0; q < val_constr.datalen; q++) {
11870 uint32_t arr_conv_16 = val_vals[q];
11871 LDKUpdateFailHTLC arr_conv_16_conv;
11872 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11873 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11874 if (arr_conv_16_conv.inner != NULL)
11875 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11876 val_constr.data[q] = arr_conv_16_conv;
11878 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11881 void CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
11882 LDKCommitmentUpdate this_ptr_conv;
11883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11884 this_ptr_conv.is_owned = false;
11885 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11886 val_constr.datalen = *val.len;
11887 if (val_constr.datalen > 0)
11888 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11890 val_constr.data = NULL;
11891 uint32_t* val_vals = (uint32_t*)(val.len + 1);
11892 for (size_t z = 0; z < val_constr.datalen; z++) {
11893 uint32_t arr_conv_25 = val_vals[z];
11894 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11895 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11896 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11897 if (arr_conv_25_conv.inner != NULL)
11898 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11899 val_constr.data[z] = arr_conv_25_conv;
11901 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11904 uint32_t CommitmentUpdate_1get_1update_1fee(void* ctx_TODO, uint32_t this_ptr) {
11905 LDKCommitmentUpdate this_ptr_conv;
11906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11907 this_ptr_conv.is_owned = false;
11908 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11911 long ret_ref = (long)ret_var.inner;
11912 if (ret_var.is_owned) {
11918 void CommitmentUpdate_1set_1update_1fee(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11919 LDKCommitmentUpdate this_ptr_conv;
11920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11921 this_ptr_conv.is_owned = false;
11922 LDKUpdateFee val_conv;
11923 val_conv.inner = (void*)(val & (~1));
11924 val_conv.is_owned = (val & 1) || (val == 0);
11925 if (val_conv.inner != NULL)
11926 val_conv = UpdateFee_clone(&val_conv);
11927 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11930 uint32_t CommitmentUpdate_1get_1commitment_1signed(void* ctx_TODO, uint32_t this_ptr) {
11931 LDKCommitmentUpdate this_ptr_conv;
11932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11933 this_ptr_conv.is_owned = false;
11934 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11937 long ret_ref = (long)ret_var.inner;
11938 if (ret_var.is_owned) {
11944 void CommitmentUpdate_1set_1commitment_1signed(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
11945 LDKCommitmentUpdate this_ptr_conv;
11946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11947 this_ptr_conv.is_owned = false;
11948 LDKCommitmentSigned val_conv;
11949 val_conv.inner = (void*)(val & (~1));
11950 val_conv.is_owned = (val & 1) || (val == 0);
11951 if (val_conv.inner != NULL)
11952 val_conv = CommitmentSigned_clone(&val_conv);
11953 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11956 uint32_t CommitmentUpdate_1new(void* ctx_TODO, uint32_tArray update_add_htlcs_arg, uint32_tArray update_fulfill_htlcs_arg, uint32_tArray update_fail_htlcs_arg, uint32_tArray update_fail_malformed_htlcs_arg, uint32_t update_fee_arg, uint32_t commitment_signed_arg) {
11957 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11958 update_add_htlcs_arg_constr.datalen = *update_add_htlcs_arg.len;
11959 if (update_add_htlcs_arg_constr.datalen > 0)
11960 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11962 update_add_htlcs_arg_constr.data = NULL;
11963 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg.len + 1);
11964 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11965 uint32_t arr_conv_15 = update_add_htlcs_arg_vals[p];
11966 LDKUpdateAddHTLC arr_conv_15_conv;
11967 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11968 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11969 if (arr_conv_15_conv.inner != NULL)
11970 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11971 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11973 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11974 update_fulfill_htlcs_arg_constr.datalen = *update_fulfill_htlcs_arg.len;
11975 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11976 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11978 update_fulfill_htlcs_arg_constr.data = NULL;
11979 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg.len + 1);
11980 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11981 uint32_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11982 LDKUpdateFulfillHTLC arr_conv_19_conv;
11983 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11984 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11985 if (arr_conv_19_conv.inner != NULL)
11986 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11987 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11989 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11990 update_fail_htlcs_arg_constr.datalen = *update_fail_htlcs_arg.len;
11991 if (update_fail_htlcs_arg_constr.datalen > 0)
11992 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11994 update_fail_htlcs_arg_constr.data = NULL;
11995 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg.len + 1);
11996 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11997 uint32_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
11998 LDKUpdateFailHTLC arr_conv_16_conv;
11999 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
12000 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12001 if (arr_conv_16_conv.inner != NULL)
12002 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
12003 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
12005 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
12006 update_fail_malformed_htlcs_arg_constr.datalen = *update_fail_malformed_htlcs_arg.len;
12007 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
12008 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12010 update_fail_malformed_htlcs_arg_constr.data = NULL;
12011 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg.len + 1);
12012 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
12013 uint32_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
12014 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
12015 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
12016 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
12017 if (arr_conv_25_conv.inner != NULL)
12018 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
12019 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
12021 LDKUpdateFee update_fee_arg_conv;
12022 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
12023 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
12024 if (update_fee_arg_conv.inner != NULL)
12025 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
12026 LDKCommitmentSigned commitment_signed_arg_conv;
12027 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
12028 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
12029 if (commitment_signed_arg_conv.inner != NULL)
12030 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
12031 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);
12032 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12033 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12034 long ret_ref = (long)ret_var.inner;
12035 if (ret_var.is_owned) {
12041 void HTLCFailChannelUpdate_1free(void* ctx_TODO, uint32_t this_ptr) {
12042 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
12043 FREE((void*)this_ptr);
12044 HTLCFailChannelUpdate_free(this_ptr_conv);
12047 uint32_t HTLCFailChannelUpdate_1clone(void* ctx_TODO, uint32_t orig) {
12048 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
12049 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
12050 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
12051 long ret_ref = (long)ret_copy;
12055 void ChannelMessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
12056 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
12057 FREE((void*)this_ptr);
12058 ChannelMessageHandler_free(this_ptr_conv);
12061 void RoutingMessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
12062 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
12063 FREE((void*)this_ptr);
12064 RoutingMessageHandler_free(this_ptr_conv);
12067 int8_tArray AcceptChannel_1write(void* ctx_TODO, uint32_t obj) {
12068 LDKAcceptChannel obj_conv;
12069 obj_conv.inner = (void*)(obj & (~1));
12070 obj_conv.is_owned = false;
12071 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
12072 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12073 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12074 CVec_u8Z_free(arg_var);
12078 uint32_t AcceptChannel_1read(void* ctx_TODO, int8_tArray ser) {
12079 LDKu8slice ser_ref;
12080 ser_ref.datalen = *ser.len;
12081 ser_ref.data = (int8_t*)(ser.len + 1);
12082 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
12083 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12084 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12085 long ret_ref = (long)ret_var.inner;
12086 if (ret_var.is_owned) {
12092 int8_tArray AnnouncementSignatures_1write(void* ctx_TODO, uint32_t obj) {
12093 LDKAnnouncementSignatures obj_conv;
12094 obj_conv.inner = (void*)(obj & (~1));
12095 obj_conv.is_owned = false;
12096 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
12097 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12098 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12099 CVec_u8Z_free(arg_var);
12103 uint32_t AnnouncementSignatures_1read(void* ctx_TODO, int8_tArray ser) {
12104 LDKu8slice ser_ref;
12105 ser_ref.datalen = *ser.len;
12106 ser_ref.data = (int8_t*)(ser.len + 1);
12107 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
12108 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12109 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12110 long ret_ref = (long)ret_var.inner;
12111 if (ret_var.is_owned) {
12117 int8_tArray ChannelReestablish_1write(void* ctx_TODO, uint32_t obj) {
12118 LDKChannelReestablish obj_conv;
12119 obj_conv.inner = (void*)(obj & (~1));
12120 obj_conv.is_owned = false;
12121 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
12122 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12123 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12124 CVec_u8Z_free(arg_var);
12128 uint32_t ChannelReestablish_1read(void* ctx_TODO, int8_tArray ser) {
12129 LDKu8slice ser_ref;
12130 ser_ref.datalen = *ser.len;
12131 ser_ref.data = (int8_t*)(ser.len + 1);
12132 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12133 *ret_conv = ChannelReestablish_read(ser_ref);
12134 return (long)ret_conv;
12137 int8_tArray ClosingSigned_1write(void* ctx_TODO, uint32_t obj) {
12138 LDKClosingSigned obj_conv;
12139 obj_conv.inner = (void*)(obj & (~1));
12140 obj_conv.is_owned = false;
12141 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
12142 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12143 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12144 CVec_u8Z_free(arg_var);
12148 uint32_t ClosingSigned_1read(void* ctx_TODO, int8_tArray ser) {
12149 LDKu8slice ser_ref;
12150 ser_ref.datalen = *ser.len;
12151 ser_ref.data = (int8_t*)(ser.len + 1);
12152 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
12153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12155 long ret_ref = (long)ret_var.inner;
12156 if (ret_var.is_owned) {
12162 int8_tArray CommitmentSigned_1write(void* ctx_TODO, uint32_t obj) {
12163 LDKCommitmentSigned obj_conv;
12164 obj_conv.inner = (void*)(obj & (~1));
12165 obj_conv.is_owned = false;
12166 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
12167 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12168 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12169 CVec_u8Z_free(arg_var);
12173 uint32_t CommitmentSigned_1read(void* ctx_TODO, int8_tArray ser) {
12174 LDKu8slice ser_ref;
12175 ser_ref.datalen = *ser.len;
12176 ser_ref.data = (int8_t*)(ser.len + 1);
12177 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
12178 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12179 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12180 long ret_ref = (long)ret_var.inner;
12181 if (ret_var.is_owned) {
12187 int8_tArray FundingCreated_1write(void* ctx_TODO, uint32_t obj) {
12188 LDKFundingCreated obj_conv;
12189 obj_conv.inner = (void*)(obj & (~1));
12190 obj_conv.is_owned = false;
12191 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
12192 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12193 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12194 CVec_u8Z_free(arg_var);
12198 uint32_t FundingCreated_1read(void* ctx_TODO, int8_tArray ser) {
12199 LDKu8slice ser_ref;
12200 ser_ref.datalen = *ser.len;
12201 ser_ref.data = (int8_t*)(ser.len + 1);
12202 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
12203 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12204 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12205 long ret_ref = (long)ret_var.inner;
12206 if (ret_var.is_owned) {
12212 int8_tArray FundingSigned_1write(void* ctx_TODO, uint32_t obj) {
12213 LDKFundingSigned obj_conv;
12214 obj_conv.inner = (void*)(obj & (~1));
12215 obj_conv.is_owned = false;
12216 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
12217 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12218 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12219 CVec_u8Z_free(arg_var);
12223 uint32_t FundingSigned_1read(void* ctx_TODO, int8_tArray ser) {
12224 LDKu8slice ser_ref;
12225 ser_ref.datalen = *ser.len;
12226 ser_ref.data = (int8_t*)(ser.len + 1);
12227 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
12228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12230 long ret_ref = (long)ret_var.inner;
12231 if (ret_var.is_owned) {
12237 int8_tArray FundingLocked_1write(void* ctx_TODO, uint32_t obj) {
12238 LDKFundingLocked obj_conv;
12239 obj_conv.inner = (void*)(obj & (~1));
12240 obj_conv.is_owned = false;
12241 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
12242 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12243 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12244 CVec_u8Z_free(arg_var);
12248 uint32_t FundingLocked_1read(void* ctx_TODO, int8_tArray ser) {
12249 LDKu8slice ser_ref;
12250 ser_ref.datalen = *ser.len;
12251 ser_ref.data = (int8_t*)(ser.len + 1);
12252 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
12253 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12254 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12255 long ret_ref = (long)ret_var.inner;
12256 if (ret_var.is_owned) {
12262 int8_tArray Init_1write(void* ctx_TODO, uint32_t obj) {
12264 obj_conv.inner = (void*)(obj & (~1));
12265 obj_conv.is_owned = false;
12266 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
12267 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12268 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12269 CVec_u8Z_free(arg_var);
12273 uint32_t Init_1read(void* ctx_TODO, int8_tArray ser) {
12274 LDKu8slice ser_ref;
12275 ser_ref.datalen = *ser.len;
12276 ser_ref.data = (int8_t*)(ser.len + 1);
12277 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12278 *ret_conv = Init_read(ser_ref);
12279 return (long)ret_conv;
12282 int8_tArray OpenChannel_1write(void* ctx_TODO, uint32_t obj) {
12283 LDKOpenChannel obj_conv;
12284 obj_conv.inner = (void*)(obj & (~1));
12285 obj_conv.is_owned = false;
12286 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
12287 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12288 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12289 CVec_u8Z_free(arg_var);
12293 uint32_t OpenChannel_1read(void* ctx_TODO, int8_tArray ser) {
12294 LDKu8slice ser_ref;
12295 ser_ref.datalen = *ser.len;
12296 ser_ref.data = (int8_t*)(ser.len + 1);
12297 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
12298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12300 long ret_ref = (long)ret_var.inner;
12301 if (ret_var.is_owned) {
12307 int8_tArray RevokeAndACK_1write(void* ctx_TODO, uint32_t obj) {
12308 LDKRevokeAndACK obj_conv;
12309 obj_conv.inner = (void*)(obj & (~1));
12310 obj_conv.is_owned = false;
12311 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
12312 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12313 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12314 CVec_u8Z_free(arg_var);
12318 uint32_t RevokeAndACK_1read(void* ctx_TODO, int8_tArray ser) {
12319 LDKu8slice ser_ref;
12320 ser_ref.datalen = *ser.len;
12321 ser_ref.data = (int8_t*)(ser.len + 1);
12322 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
12323 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12324 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12325 long ret_ref = (long)ret_var.inner;
12326 if (ret_var.is_owned) {
12332 int8_tArray Shutdown_1write(void* ctx_TODO, uint32_t obj) {
12333 LDKShutdown obj_conv;
12334 obj_conv.inner = (void*)(obj & (~1));
12335 obj_conv.is_owned = false;
12336 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
12337 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12338 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12339 CVec_u8Z_free(arg_var);
12343 uint32_t Shutdown_1read(void* ctx_TODO, int8_tArray ser) {
12344 LDKu8slice ser_ref;
12345 ser_ref.datalen = *ser.len;
12346 ser_ref.data = (int8_t*)(ser.len + 1);
12347 LDKShutdown ret_var = Shutdown_read(ser_ref);
12348 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12349 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12350 long ret_ref = (long)ret_var.inner;
12351 if (ret_var.is_owned) {
12357 int8_tArray UpdateFailHTLC_1write(void* ctx_TODO, uint32_t obj) {
12358 LDKUpdateFailHTLC obj_conv;
12359 obj_conv.inner = (void*)(obj & (~1));
12360 obj_conv.is_owned = false;
12361 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
12362 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12363 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12364 CVec_u8Z_free(arg_var);
12368 uint32_t UpdateFailHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12369 LDKu8slice ser_ref;
12370 ser_ref.datalen = *ser.len;
12371 ser_ref.data = (int8_t*)(ser.len + 1);
12372 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
12373 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12374 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12375 long ret_ref = (long)ret_var.inner;
12376 if (ret_var.is_owned) {
12382 int8_tArray UpdateFailMalformedHTLC_1write(void* ctx_TODO, uint32_t obj) {
12383 LDKUpdateFailMalformedHTLC obj_conv;
12384 obj_conv.inner = (void*)(obj & (~1));
12385 obj_conv.is_owned = false;
12386 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
12387 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12388 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12389 CVec_u8Z_free(arg_var);
12393 uint32_t UpdateFailMalformedHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12394 LDKu8slice ser_ref;
12395 ser_ref.datalen = *ser.len;
12396 ser_ref.data = (int8_t*)(ser.len + 1);
12397 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
12398 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12399 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12400 long ret_ref = (long)ret_var.inner;
12401 if (ret_var.is_owned) {
12407 int8_tArray UpdateFee_1write(void* ctx_TODO, uint32_t obj) {
12408 LDKUpdateFee obj_conv;
12409 obj_conv.inner = (void*)(obj & (~1));
12410 obj_conv.is_owned = false;
12411 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
12412 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12413 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12414 CVec_u8Z_free(arg_var);
12418 uint32_t UpdateFee_1read(void* ctx_TODO, int8_tArray ser) {
12419 LDKu8slice ser_ref;
12420 ser_ref.datalen = *ser.len;
12421 ser_ref.data = (int8_t*)(ser.len + 1);
12422 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
12423 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12424 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12425 long ret_ref = (long)ret_var.inner;
12426 if (ret_var.is_owned) {
12432 int8_tArray UpdateFulfillHTLC_1write(void* ctx_TODO, uint32_t obj) {
12433 LDKUpdateFulfillHTLC obj_conv;
12434 obj_conv.inner = (void*)(obj & (~1));
12435 obj_conv.is_owned = false;
12436 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
12437 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12438 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12439 CVec_u8Z_free(arg_var);
12443 uint32_t UpdateFulfillHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12444 LDKu8slice ser_ref;
12445 ser_ref.datalen = *ser.len;
12446 ser_ref.data = (int8_t*)(ser.len + 1);
12447 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
12448 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12449 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12450 long ret_ref = (long)ret_var.inner;
12451 if (ret_var.is_owned) {
12457 int8_tArray UpdateAddHTLC_1write(void* ctx_TODO, uint32_t obj) {
12458 LDKUpdateAddHTLC obj_conv;
12459 obj_conv.inner = (void*)(obj & (~1));
12460 obj_conv.is_owned = false;
12461 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
12462 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12463 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12464 CVec_u8Z_free(arg_var);
12468 uint32_t UpdateAddHTLC_1read(void* ctx_TODO, int8_tArray ser) {
12469 LDKu8slice ser_ref;
12470 ser_ref.datalen = *ser.len;
12471 ser_ref.data = (int8_t*)(ser.len + 1);
12472 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
12473 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12474 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12475 long ret_ref = (long)ret_var.inner;
12476 if (ret_var.is_owned) {
12482 int8_tArray Ping_1write(void* ctx_TODO, uint32_t obj) {
12484 obj_conv.inner = (void*)(obj & (~1));
12485 obj_conv.is_owned = false;
12486 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
12487 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12488 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12489 CVec_u8Z_free(arg_var);
12493 uint32_t Ping_1read(void* ctx_TODO, int8_tArray ser) {
12494 LDKu8slice ser_ref;
12495 ser_ref.datalen = *ser.len;
12496 ser_ref.data = (int8_t*)(ser.len + 1);
12497 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12498 *ret_conv = Ping_read(ser_ref);
12499 return (long)ret_conv;
12502 int8_tArray Pong_1write(void* ctx_TODO, uint32_t obj) {
12504 obj_conv.inner = (void*)(obj & (~1));
12505 obj_conv.is_owned = false;
12506 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
12507 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12508 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12509 CVec_u8Z_free(arg_var);
12513 uint32_t Pong_1read(void* ctx_TODO, int8_tArray ser) {
12514 LDKu8slice ser_ref;
12515 ser_ref.datalen = *ser.len;
12516 ser_ref.data = (int8_t*)(ser.len + 1);
12517 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12518 *ret_conv = Pong_read(ser_ref);
12519 return (long)ret_conv;
12522 int8_tArray UnsignedChannelAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12523 LDKUnsignedChannelAnnouncement obj_conv;
12524 obj_conv.inner = (void*)(obj & (~1));
12525 obj_conv.is_owned = false;
12526 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
12527 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12528 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12529 CVec_u8Z_free(arg_var);
12533 uint32_t UnsignedChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12534 LDKu8slice ser_ref;
12535 ser_ref.datalen = *ser.len;
12536 ser_ref.data = (int8_t*)(ser.len + 1);
12537 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12538 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
12539 return (long)ret_conv;
12542 int8_tArray ChannelAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12543 LDKChannelAnnouncement obj_conv;
12544 obj_conv.inner = (void*)(obj & (~1));
12545 obj_conv.is_owned = false;
12546 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
12547 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12548 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12549 CVec_u8Z_free(arg_var);
12553 uint32_t ChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12554 LDKu8slice ser_ref;
12555 ser_ref.datalen = *ser.len;
12556 ser_ref.data = (int8_t*)(ser.len + 1);
12557 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
12558 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12559 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12560 long ret_ref = (long)ret_var.inner;
12561 if (ret_var.is_owned) {
12567 int8_tArray UnsignedChannelUpdate_1write(void* ctx_TODO, uint32_t obj) {
12568 LDKUnsignedChannelUpdate obj_conv;
12569 obj_conv.inner = (void*)(obj & (~1));
12570 obj_conv.is_owned = false;
12571 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
12572 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12573 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12574 CVec_u8Z_free(arg_var);
12578 uint32_t UnsignedChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
12579 LDKu8slice ser_ref;
12580 ser_ref.datalen = *ser.len;
12581 ser_ref.data = (int8_t*)(ser.len + 1);
12582 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12583 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
12584 return (long)ret_conv;
12587 int8_tArray ChannelUpdate_1write(void* ctx_TODO, uint32_t obj) {
12588 LDKChannelUpdate obj_conv;
12589 obj_conv.inner = (void*)(obj & (~1));
12590 obj_conv.is_owned = false;
12591 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
12592 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12593 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12594 CVec_u8Z_free(arg_var);
12598 uint32_t ChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
12599 LDKu8slice ser_ref;
12600 ser_ref.datalen = *ser.len;
12601 ser_ref.data = (int8_t*)(ser.len + 1);
12602 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
12603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12605 long ret_ref = (long)ret_var.inner;
12606 if (ret_var.is_owned) {
12612 int8_tArray ErrorMessage_1write(void* ctx_TODO, uint32_t obj) {
12613 LDKErrorMessage obj_conv;
12614 obj_conv.inner = (void*)(obj & (~1));
12615 obj_conv.is_owned = false;
12616 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
12617 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12618 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12619 CVec_u8Z_free(arg_var);
12623 uint32_t ErrorMessage_1read(void* ctx_TODO, int8_tArray ser) {
12624 LDKu8slice ser_ref;
12625 ser_ref.datalen = *ser.len;
12626 ser_ref.data = (int8_t*)(ser.len + 1);
12627 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12628 *ret_conv = ErrorMessage_read(ser_ref);
12629 return (long)ret_conv;
12632 int8_tArray UnsignedNodeAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12633 LDKUnsignedNodeAnnouncement obj_conv;
12634 obj_conv.inner = (void*)(obj & (~1));
12635 obj_conv.is_owned = false;
12636 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
12637 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12638 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12639 CVec_u8Z_free(arg_var);
12643 uint32_t UnsignedNodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12644 LDKu8slice ser_ref;
12645 ser_ref.datalen = *ser.len;
12646 ser_ref.data = (int8_t*)(ser.len + 1);
12647 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12648 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
12649 return (long)ret_conv;
12652 int8_tArray NodeAnnouncement_1write(void* ctx_TODO, uint32_t obj) {
12653 LDKNodeAnnouncement obj_conv;
12654 obj_conv.inner = (void*)(obj & (~1));
12655 obj_conv.is_owned = false;
12656 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12657 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12658 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12659 CVec_u8Z_free(arg_var);
12663 uint32_t NodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
12664 LDKu8slice ser_ref;
12665 ser_ref.datalen = *ser.len;
12666 ser_ref.data = (int8_t*)(ser.len + 1);
12667 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12668 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12669 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12670 long ret_ref = (long)ret_var.inner;
12671 if (ret_var.is_owned) {
12677 uint32_t QueryShortChannelIds_1read(void* ctx_TODO, int8_tArray ser) {
12678 LDKu8slice ser_ref;
12679 ser_ref.datalen = *ser.len;
12680 ser_ref.data = (int8_t*)(ser.len + 1);
12681 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12682 *ret_conv = QueryShortChannelIds_read(ser_ref);
12683 return (long)ret_conv;
12686 int8_tArray QueryShortChannelIds_1write(void* ctx_TODO, uint32_t obj) {
12687 LDKQueryShortChannelIds obj_conv;
12688 obj_conv.inner = (void*)(obj & (~1));
12689 obj_conv.is_owned = false;
12690 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
12691 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12692 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12693 CVec_u8Z_free(arg_var);
12697 uint32_t ReplyShortChannelIdsEnd_1read(void* ctx_TODO, int8_tArray ser) {
12698 LDKu8slice ser_ref;
12699 ser_ref.datalen = *ser.len;
12700 ser_ref.data = (int8_t*)(ser.len + 1);
12701 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12702 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
12703 return (long)ret_conv;
12706 int8_tArray ReplyShortChannelIdsEnd_1write(void* ctx_TODO, uint32_t obj) {
12707 LDKReplyShortChannelIdsEnd obj_conv;
12708 obj_conv.inner = (void*)(obj & (~1));
12709 obj_conv.is_owned = false;
12710 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
12711 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12712 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12713 CVec_u8Z_free(arg_var);
12717 uint32_t QueryChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
12718 LDKu8slice ser_ref;
12719 ser_ref.datalen = *ser.len;
12720 ser_ref.data = (int8_t*)(ser.len + 1);
12721 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12722 *ret_conv = QueryChannelRange_read(ser_ref);
12723 return (long)ret_conv;
12726 int8_tArray QueryChannelRange_1write(void* ctx_TODO, uint32_t obj) {
12727 LDKQueryChannelRange obj_conv;
12728 obj_conv.inner = (void*)(obj & (~1));
12729 obj_conv.is_owned = false;
12730 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
12731 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12732 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12733 CVec_u8Z_free(arg_var);
12737 uint32_t ReplyChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
12738 LDKu8slice ser_ref;
12739 ser_ref.datalen = *ser.len;
12740 ser_ref.data = (int8_t*)(ser.len + 1);
12741 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12742 *ret_conv = ReplyChannelRange_read(ser_ref);
12743 return (long)ret_conv;
12746 int8_tArray ReplyChannelRange_1write(void* ctx_TODO, uint32_t obj) {
12747 LDKReplyChannelRange obj_conv;
12748 obj_conv.inner = (void*)(obj & (~1));
12749 obj_conv.is_owned = false;
12750 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
12751 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12752 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12753 CVec_u8Z_free(arg_var);
12757 uint32_t GossipTimestampFilter_1read(void* ctx_TODO, int8_tArray ser) {
12758 LDKu8slice ser_ref;
12759 ser_ref.datalen = *ser.len;
12760 ser_ref.data = (int8_t*)(ser.len + 1);
12761 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12762 *ret_conv = GossipTimestampFilter_read(ser_ref);
12763 return (long)ret_conv;
12766 int8_tArray GossipTimestampFilter_1write(void* ctx_TODO, uint32_t obj) {
12767 LDKGossipTimestampFilter obj_conv;
12768 obj_conv.inner = (void*)(obj & (~1));
12769 obj_conv.is_owned = false;
12770 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
12771 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
12772 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
12773 CVec_u8Z_free(arg_var);
12777 void MessageHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
12778 LDKMessageHandler this_ptr_conv;
12779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12781 MessageHandler_free(this_ptr_conv);
12784 uint32_t MessageHandler_1get_1chan_1handler(void* ctx_TODO, uint32_t this_ptr) {
12785 LDKMessageHandler this_ptr_conv;
12786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12787 this_ptr_conv.is_owned = false;
12788 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12792 void MessageHandler_1set_1chan_1handler(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12793 LDKMessageHandler this_ptr_conv;
12794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12795 this_ptr_conv.is_owned = false;
12796 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12797 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12800 uint32_t MessageHandler_1get_1route_1handler(void* ctx_TODO, uint32_t this_ptr) {
12801 LDKMessageHandler this_ptr_conv;
12802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12803 this_ptr_conv.is_owned = false;
12804 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12808 void MessageHandler_1set_1route_1handler(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
12809 LDKMessageHandler this_ptr_conv;
12810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12811 this_ptr_conv.is_owned = false;
12812 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12813 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12816 uint32_t MessageHandler_1new(void* ctx_TODO, uint32_t chan_handler_arg, uint32_t route_handler_arg) {
12817 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12818 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12819 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12822 long ret_ref = (long)ret_var.inner;
12823 if (ret_var.is_owned) {
12829 uint32_t SocketDescriptor_1clone(void* ctx_TODO, uint32_t orig) {
12830 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
12831 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12832 *ret = SocketDescriptor_clone(orig_conv);
12836 void SocketDescriptor_1free(void* ctx_TODO, uint32_t this_ptr) {
12837 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12838 FREE((void*)this_ptr);
12839 SocketDescriptor_free(this_ptr_conv);
12842 void PeerHandleError_1free(void* ctx_TODO, uint32_t this_ptr) {
12843 LDKPeerHandleError this_ptr_conv;
12844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12846 PeerHandleError_free(this_ptr_conv);
12849 jboolean PeerHandleError_1get_1no_1connection_1possible(void* ctx_TODO, uint32_t this_ptr) {
12850 LDKPeerHandleError this_ptr_conv;
12851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12852 this_ptr_conv.is_owned = false;
12853 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12857 void PeerHandleError_1set_1no_1connection_1possible(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
12858 LDKPeerHandleError this_ptr_conv;
12859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12860 this_ptr_conv.is_owned = false;
12861 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12864 uint32_t PeerHandleError_1new(void* ctx_TODO, jboolean no_connection_possible_arg) {
12865 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12866 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12867 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12868 long ret_ref = (long)ret_var.inner;
12869 if (ret_var.is_owned) {
12875 void PeerManager_1free(void* ctx_TODO, uint32_t this_ptr) {
12876 LDKPeerManager this_ptr_conv;
12877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12879 PeerManager_free(this_ptr_conv);
12882 uint32_t PeerManager_1new(void* ctx_TODO, uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger) {
12883 LDKMessageHandler message_handler_conv;
12884 message_handler_conv.inner = (void*)(message_handler & (~1));
12885 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12886 // Warning: we may need a move here but can't clone!
12887 LDKSecretKey our_node_secret_ref;
12888 CHECK(*our_node_secret.len == 32);
12889 memcpy(our_node_secret_ref.bytes, our_node_secret.len + 1, 32);
12890 unsigned char ephemeral_random_data_arr[32];
12891 CHECK(*ephemeral_random_data.len == 32);
12892 memcpy(ephemeral_random_data_arr, ephemeral_random_data.len + 1, 32);
12893 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12894 LDKLogger logger_conv = *(LDKLogger*)logger;
12895 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12896 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12897 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12898 long ret_ref = (long)ret_var.inner;
12899 if (ret_var.is_owned) {
12905 ptrArray PeerManager_1get_1peer_1node_1ids(void* ctx_TODO, uint32_t this_arg) {
12906 LDKPeerManager this_arg_conv;
12907 this_arg_conv.inner = (void*)(this_arg & (~1));
12908 this_arg_conv.is_owned = false;
12909 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12910 ptrArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
12911 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr.len + 1);
12912 for (size_t m = 0; m < ret_var.datalen; m++) {
12913 int8_tArray arr_conv_12_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
12914 memcpy(arr_conv_12_arr.len + 1, ret_var.data[m].compressed_form, 33);
12915 ret_arr_ptr[m] = arr_conv_12_arr;
12917 FREE(ret_var.data);
12921 uint32_t PeerManager_1new_1outbound_1connection(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
12922 LDKPeerManager this_arg_conv;
12923 this_arg_conv.inner = (void*)(this_arg & (~1));
12924 this_arg_conv.is_owned = false;
12925 LDKPublicKey their_node_id_ref;
12926 CHECK(*their_node_id.len == 33);
12927 memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
12928 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12929 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12930 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12931 return (long)ret_conv;
12934 uint32_t PeerManager_1new_1inbound_1connection(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
12935 LDKPeerManager this_arg_conv;
12936 this_arg_conv.inner = (void*)(this_arg & (~1));
12937 this_arg_conv.is_owned = false;
12938 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12939 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12940 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12941 return (long)ret_conv;
12944 uint32_t PeerManager_1write_1buffer_1space_1avail(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
12945 LDKPeerManager this_arg_conv;
12946 this_arg_conv.inner = (void*)(this_arg & (~1));
12947 this_arg_conv.is_owned = false;
12948 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12949 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12950 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12951 return (long)ret_conv;
12954 uint32_t PeerManager_1read_1event(void* ctx_TODO, uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
12955 LDKPeerManager this_arg_conv;
12956 this_arg_conv.inner = (void*)(this_arg & (~1));
12957 this_arg_conv.is_owned = false;
12958 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12959 LDKu8slice data_ref;
12960 data_ref.datalen = *data.len;
12961 data_ref.data = (int8_t*)(data.len + 1);
12962 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12963 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12964 return (long)ret_conv;
12967 void PeerManager_1process_1events(void* ctx_TODO, uint32_t this_arg) {
12968 LDKPeerManager this_arg_conv;
12969 this_arg_conv.inner = (void*)(this_arg & (~1));
12970 this_arg_conv.is_owned = false;
12971 PeerManager_process_events(&this_arg_conv);
12974 void PeerManager_1socket_1disconnected(void* ctx_TODO, uint32_t this_arg, uint32_t descriptor) {
12975 LDKPeerManager this_arg_conv;
12976 this_arg_conv.inner = (void*)(this_arg & (~1));
12977 this_arg_conv.is_owned = false;
12978 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12979 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12982 void PeerManager_1timer_1tick_1occured(void* ctx_TODO, uint32_t this_arg) {
12983 LDKPeerManager this_arg_conv;
12984 this_arg_conv.inner = (void*)(this_arg & (~1));
12985 this_arg_conv.is_owned = false;
12986 PeerManager_timer_tick_occured(&this_arg_conv);
12989 int8_tArray build_1commitment_1secret(void* ctx_TODO, int8_tArray commitment_seed, int64_t idx) {
12990 unsigned char commitment_seed_arr[32];
12991 CHECK(*commitment_seed.len == 32);
12992 memcpy(commitment_seed_arr, commitment_seed.len + 1, 32);
12993 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12994 int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
12995 memcpy(arg_arr.len + 1, build_commitment_secret(commitment_seed_ref, idx).data, 32);
12999 uint32_t derive_1private_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_secret) {
13000 LDKPublicKey per_commitment_point_ref;
13001 CHECK(*per_commitment_point.len == 33);
13002 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
13003 unsigned char base_secret_arr[32];
13004 CHECK(*base_secret.len == 32);
13005 memcpy(base_secret_arr, base_secret.len + 1, 32);
13006 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
13007 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
13008 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
13009 return (long)ret_conv;
13012 uint32_t derive_1public_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_point) {
13013 LDKPublicKey per_commitment_point_ref;
13014 CHECK(*per_commitment_point.len == 33);
13015 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
13016 LDKPublicKey base_point_ref;
13017 CHECK(*base_point.len == 33);
13018 memcpy(base_point_ref.compressed_form, base_point.len + 1, 33);
13019 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
13020 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
13021 return (long)ret_conv;
13024 uint32_t derive_1private_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
13025 unsigned char per_commitment_secret_arr[32];
13026 CHECK(*per_commitment_secret.len == 32);
13027 memcpy(per_commitment_secret_arr, per_commitment_secret.len + 1, 32);
13028 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
13029 unsigned char countersignatory_revocation_base_secret_arr[32];
13030 CHECK(*countersignatory_revocation_base_secret.len == 32);
13031 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret.len + 1, 32);
13032 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
13033 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
13034 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
13035 return (long)ret_conv;
13038 uint32_t derive_1public_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
13039 LDKPublicKey per_commitment_point_ref;
13040 CHECK(*per_commitment_point.len == 33);
13041 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
13042 LDKPublicKey countersignatory_revocation_base_point_ref;
13043 CHECK(*countersignatory_revocation_base_point.len == 33);
13044 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point.len + 1, 33);
13045 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
13046 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
13047 return (long)ret_conv;
13050 void TxCreationKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
13051 LDKTxCreationKeys this_ptr_conv;
13052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13054 TxCreationKeys_free(this_ptr_conv);
13057 uint32_t TxCreationKeys_1clone(void* ctx_TODO, uint32_t orig) {
13058 LDKTxCreationKeys orig_conv;
13059 orig_conv.inner = (void*)(orig & (~1));
13060 orig_conv.is_owned = false;
13061 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
13062 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13063 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13064 long ret_ref = (long)ret_var.inner;
13065 if (ret_var.is_owned) {
13071 int8_tArray TxCreationKeys_1get_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr) {
13072 LDKTxCreationKeys this_ptr_conv;
13073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13074 this_ptr_conv.is_owned = false;
13075 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13076 memcpy(arg_arr.len + 1, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13080 void TxCreationKeys_1set_1per_1commitment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13081 LDKTxCreationKeys this_ptr_conv;
13082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13083 this_ptr_conv.is_owned = false;
13084 LDKPublicKey val_ref;
13085 CHECK(*val.len == 33);
13086 memcpy(val_ref.compressed_form, val.len + 1, 33);
13087 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
13090 int8_tArray TxCreationKeys_1get_1revocation_1key(void* ctx_TODO, uint32_t this_ptr) {
13091 LDKTxCreationKeys this_ptr_conv;
13092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13093 this_ptr_conv.is_owned = false;
13094 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13095 memcpy(arg_arr.len + 1, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
13099 void TxCreationKeys_1set_1revocation_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13100 LDKTxCreationKeys this_ptr_conv;
13101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13102 this_ptr_conv.is_owned = false;
13103 LDKPublicKey val_ref;
13104 CHECK(*val.len == 33);
13105 memcpy(val_ref.compressed_form, val.len + 1, 33);
13106 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
13109 int8_tArray TxCreationKeys_1get_1broadcaster_1htlc_1key(void* ctx_TODO, uint32_t this_ptr) {
13110 LDKTxCreationKeys this_ptr_conv;
13111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13112 this_ptr_conv.is_owned = false;
13113 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13114 memcpy(arg_arr.len + 1, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
13118 void TxCreationKeys_1set_1broadcaster_1htlc_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13119 LDKTxCreationKeys this_ptr_conv;
13120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13121 this_ptr_conv.is_owned = false;
13122 LDKPublicKey val_ref;
13123 CHECK(*val.len == 33);
13124 memcpy(val_ref.compressed_form, val.len + 1, 33);
13125 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
13128 int8_tArray TxCreationKeys_1get_1countersignatory_1htlc_1key(void* ctx_TODO, uint32_t this_ptr) {
13129 LDKTxCreationKeys this_ptr_conv;
13130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13131 this_ptr_conv.is_owned = false;
13132 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13133 memcpy(arg_arr.len + 1, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
13137 void TxCreationKeys_1set_1countersignatory_1htlc_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13138 LDKTxCreationKeys this_ptr_conv;
13139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13140 this_ptr_conv.is_owned = false;
13141 LDKPublicKey val_ref;
13142 CHECK(*val.len == 33);
13143 memcpy(val_ref.compressed_form, val.len + 1, 33);
13144 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
13147 int8_tArray TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(void* ctx_TODO, uint32_t this_ptr) {
13148 LDKTxCreationKeys this_ptr_conv;
13149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13150 this_ptr_conv.is_owned = false;
13151 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13152 memcpy(arg_arr.len + 1, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
13156 void TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13157 LDKTxCreationKeys this_ptr_conv;
13158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13159 this_ptr_conv.is_owned = false;
13160 LDKPublicKey val_ref;
13161 CHECK(*val.len == 33);
13162 memcpy(val_ref.compressed_form, val.len + 1, 33);
13163 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
13166 uint32_t TxCreationKeys_1new(void* ctx_TODO, int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
13167 LDKPublicKey per_commitment_point_arg_ref;
13168 CHECK(*per_commitment_point_arg.len == 33);
13169 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg.len + 1, 33);
13170 LDKPublicKey revocation_key_arg_ref;
13171 CHECK(*revocation_key_arg.len == 33);
13172 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg.len + 1, 33);
13173 LDKPublicKey broadcaster_htlc_key_arg_ref;
13174 CHECK(*broadcaster_htlc_key_arg.len == 33);
13175 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg.len + 1, 33);
13176 LDKPublicKey countersignatory_htlc_key_arg_ref;
13177 CHECK(*countersignatory_htlc_key_arg.len == 33);
13178 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg.len + 1, 33);
13179 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
13180 CHECK(*broadcaster_delayed_payment_key_arg.len == 33);
13181 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg.len + 1, 33);
13182 LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
13183 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13184 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13185 long ret_ref = (long)ret_var.inner;
13186 if (ret_var.is_owned) {
13192 int8_tArray TxCreationKeys_1write(void* ctx_TODO, uint32_t obj) {
13193 LDKTxCreationKeys obj_conv;
13194 obj_conv.inner = (void*)(obj & (~1));
13195 obj_conv.is_owned = false;
13196 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
13197 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13198 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13199 CVec_u8Z_free(arg_var);
13203 uint32_t TxCreationKeys_1read(void* ctx_TODO, int8_tArray ser) {
13204 LDKu8slice ser_ref;
13205 ser_ref.datalen = *ser.len;
13206 ser_ref.data = (int8_t*)(ser.len + 1);
13207 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
13208 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13209 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13210 long ret_ref = (long)ret_var.inner;
13211 if (ret_var.is_owned) {
13217 void ChannelPublicKeys_1free(void* ctx_TODO, uint32_t this_ptr) {
13218 LDKChannelPublicKeys this_ptr_conv;
13219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13221 ChannelPublicKeys_free(this_ptr_conv);
13224 uint32_t ChannelPublicKeys_1clone(void* ctx_TODO, uint32_t orig) {
13225 LDKChannelPublicKeys orig_conv;
13226 orig_conv.inner = (void*)(orig & (~1));
13227 orig_conv.is_owned = false;
13228 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
13229 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13230 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13231 long ret_ref = (long)ret_var.inner;
13232 if (ret_var.is_owned) {
13238 int8_tArray ChannelPublicKeys_1get_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
13239 LDKChannelPublicKeys this_ptr_conv;
13240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13241 this_ptr_conv.is_owned = false;
13242 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13243 memcpy(arg_arr.len + 1, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
13247 void ChannelPublicKeys_1set_1funding_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13248 LDKChannelPublicKeys this_ptr_conv;
13249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13250 this_ptr_conv.is_owned = false;
13251 LDKPublicKey val_ref;
13252 CHECK(*val.len == 33);
13253 memcpy(val_ref.compressed_form, val.len + 1, 33);
13254 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
13257 int8_tArray ChannelPublicKeys_1get_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
13258 LDKChannelPublicKeys this_ptr_conv;
13259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13260 this_ptr_conv.is_owned = false;
13261 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13262 memcpy(arg_arr.len + 1, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
13266 void ChannelPublicKeys_1set_1revocation_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13267 LDKChannelPublicKeys this_ptr_conv;
13268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13269 this_ptr_conv.is_owned = false;
13270 LDKPublicKey val_ref;
13271 CHECK(*val.len == 33);
13272 memcpy(val_ref.compressed_form, val.len + 1, 33);
13273 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
13276 int8_tArray ChannelPublicKeys_1get_1payment_1point(void* ctx_TODO, uint32_t this_ptr) {
13277 LDKChannelPublicKeys this_ptr_conv;
13278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13279 this_ptr_conv.is_owned = false;
13280 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13281 memcpy(arg_arr.len + 1, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
13285 void ChannelPublicKeys_1set_1payment_1point(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13286 LDKChannelPublicKeys this_ptr_conv;
13287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13288 this_ptr_conv.is_owned = false;
13289 LDKPublicKey val_ref;
13290 CHECK(*val.len == 33);
13291 memcpy(val_ref.compressed_form, val.len + 1, 33);
13292 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
13295 int8_tArray ChannelPublicKeys_1get_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
13296 LDKChannelPublicKeys this_ptr_conv;
13297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13298 this_ptr_conv.is_owned = false;
13299 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13300 memcpy(arg_arr.len + 1, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
13304 void ChannelPublicKeys_1set_1delayed_1payment_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13305 LDKChannelPublicKeys this_ptr_conv;
13306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13307 this_ptr_conv.is_owned = false;
13308 LDKPublicKey val_ref;
13309 CHECK(*val.len == 33);
13310 memcpy(val_ref.compressed_form, val.len + 1, 33);
13311 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
13314 int8_tArray ChannelPublicKeys_1get_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr) {
13315 LDKChannelPublicKeys this_ptr_conv;
13316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13317 this_ptr_conv.is_owned = false;
13318 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13319 memcpy(arg_arr.len + 1, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
13323 void ChannelPublicKeys_1set_1htlc_1basepoint(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13324 LDKChannelPublicKeys this_ptr_conv;
13325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13326 this_ptr_conv.is_owned = false;
13327 LDKPublicKey val_ref;
13328 CHECK(*val.len == 33);
13329 memcpy(val_ref.compressed_form, val.len + 1, 33);
13330 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
13333 uint32_t ChannelPublicKeys_1new(void* ctx_TODO, 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) {
13334 LDKPublicKey funding_pubkey_arg_ref;
13335 CHECK(*funding_pubkey_arg.len == 33);
13336 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg.len + 1, 33);
13337 LDKPublicKey revocation_basepoint_arg_ref;
13338 CHECK(*revocation_basepoint_arg.len == 33);
13339 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg.len + 1, 33);
13340 LDKPublicKey payment_point_arg_ref;
13341 CHECK(*payment_point_arg.len == 33);
13342 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg.len + 1, 33);
13343 LDKPublicKey delayed_payment_basepoint_arg_ref;
13344 CHECK(*delayed_payment_basepoint_arg.len == 33);
13345 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg.len + 1, 33);
13346 LDKPublicKey htlc_basepoint_arg_ref;
13347 CHECK(*htlc_basepoint_arg.len == 33);
13348 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg.len + 1, 33);
13349 LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
13350 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13351 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13352 long ret_ref = (long)ret_var.inner;
13353 if (ret_var.is_owned) {
13359 int8_tArray ChannelPublicKeys_1write(void* ctx_TODO, uint32_t obj) {
13360 LDKChannelPublicKeys obj_conv;
13361 obj_conv.inner = (void*)(obj & (~1));
13362 obj_conv.is_owned = false;
13363 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
13364 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13365 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13366 CVec_u8Z_free(arg_var);
13370 uint32_t ChannelPublicKeys_1read(void* ctx_TODO, int8_tArray ser) {
13371 LDKu8slice ser_ref;
13372 ser_ref.datalen = *ser.len;
13373 ser_ref.data = (int8_t*)(ser.len + 1);
13374 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
13375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13377 long ret_ref = (long)ret_var.inner;
13378 if (ret_var.is_owned) {
13384 uint32_t TxCreationKeys_1derive_1new(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
13385 LDKPublicKey per_commitment_point_ref;
13386 CHECK(*per_commitment_point.len == 33);
13387 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
13388 LDKPublicKey broadcaster_delayed_payment_base_ref;
13389 CHECK(*broadcaster_delayed_payment_base.len == 33);
13390 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base.len + 1, 33);
13391 LDKPublicKey broadcaster_htlc_base_ref;
13392 CHECK(*broadcaster_htlc_base.len == 33);
13393 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base.len + 1, 33);
13394 LDKPublicKey countersignatory_revocation_base_ref;
13395 CHECK(*countersignatory_revocation_base.len == 33);
13396 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base.len + 1, 33);
13397 LDKPublicKey countersignatory_htlc_base_ref;
13398 CHECK(*countersignatory_htlc_base.len == 33);
13399 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base.len + 1, 33);
13400 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
13401 *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
13402 return (long)ret_conv;
13405 uint32_t TxCreationKeys_1from_1channel_1static_1keys(void* ctx_TODO, int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
13406 LDKPublicKey per_commitment_point_ref;
13407 CHECK(*per_commitment_point.len == 33);
13408 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
13409 LDKChannelPublicKeys broadcaster_keys_conv;
13410 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
13411 broadcaster_keys_conv.is_owned = false;
13412 LDKChannelPublicKeys countersignatory_keys_conv;
13413 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
13414 countersignatory_keys_conv.is_owned = false;
13415 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
13416 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
13417 return (long)ret_conv;
13420 int8_tArray get_1revokeable_1redeemscript(void* ctx_TODO, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
13421 LDKPublicKey revocation_key_ref;
13422 CHECK(*revocation_key.len == 33);
13423 memcpy(revocation_key_ref.compressed_form, revocation_key.len + 1, 33);
13424 LDKPublicKey broadcaster_delayed_payment_key_ref;
13425 CHECK(*broadcaster_delayed_payment_key.len == 33);
13426 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.len + 1, 33);
13427 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
13428 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13429 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13430 CVec_u8Z_free(arg_var);
13434 void HTLCOutputInCommitment_1free(void* ctx_TODO, uint32_t this_ptr) {
13435 LDKHTLCOutputInCommitment this_ptr_conv;
13436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13438 HTLCOutputInCommitment_free(this_ptr_conv);
13441 uint32_t HTLCOutputInCommitment_1clone(void* ctx_TODO, uint32_t orig) {
13442 LDKHTLCOutputInCommitment orig_conv;
13443 orig_conv.inner = (void*)(orig & (~1));
13444 orig_conv.is_owned = false;
13445 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
13446 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13447 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13448 long ret_ref = (long)ret_var.inner;
13449 if (ret_var.is_owned) {
13455 jboolean HTLCOutputInCommitment_1get_1offered(void* ctx_TODO, uint32_t this_ptr) {
13456 LDKHTLCOutputInCommitment this_ptr_conv;
13457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13458 this_ptr_conv.is_owned = false;
13459 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
13463 void HTLCOutputInCommitment_1set_1offered(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
13464 LDKHTLCOutputInCommitment this_ptr_conv;
13465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13466 this_ptr_conv.is_owned = false;
13467 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
13470 int64_t HTLCOutputInCommitment_1get_1amount_1msat(void* ctx_TODO, uint32_t this_ptr) {
13471 LDKHTLCOutputInCommitment this_ptr_conv;
13472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13473 this_ptr_conv.is_owned = false;
13474 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
13478 void HTLCOutputInCommitment_1set_1amount_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
13479 LDKHTLCOutputInCommitment this_ptr_conv;
13480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13481 this_ptr_conv.is_owned = false;
13482 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
13485 int32_t HTLCOutputInCommitment_1get_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr) {
13486 LDKHTLCOutputInCommitment this_ptr_conv;
13487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13488 this_ptr_conv.is_owned = false;
13489 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
13493 void HTLCOutputInCommitment_1set_1cltv_1expiry(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
13494 LDKHTLCOutputInCommitment this_ptr_conv;
13495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13496 this_ptr_conv.is_owned = false;
13497 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
13500 int8_tArray HTLCOutputInCommitment_1get_1payment_1hash(void* ctx_TODO, uint32_t this_ptr) {
13501 LDKHTLCOutputInCommitment this_ptr_conv;
13502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13503 this_ptr_conv.is_owned = false;
13504 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
13505 memcpy(ret_arr.len + 1, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
13509 void HTLCOutputInCommitment_1set_1payment_1hash(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
13510 LDKHTLCOutputInCommitment this_ptr_conv;
13511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13512 this_ptr_conv.is_owned = false;
13513 LDKThirtyTwoBytes val_ref;
13514 CHECK(*val.len == 32);
13515 memcpy(val_ref.data, val.len + 1, 32);
13516 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
13519 int8_tArray HTLCOutputInCommitment_1write(void* ctx_TODO, uint32_t obj) {
13520 LDKHTLCOutputInCommitment obj_conv;
13521 obj_conv.inner = (void*)(obj & (~1));
13522 obj_conv.is_owned = false;
13523 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
13524 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13525 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13526 CVec_u8Z_free(arg_var);
13530 uint32_t HTLCOutputInCommitment_1read(void* ctx_TODO, int8_tArray ser) {
13531 LDKu8slice ser_ref;
13532 ser_ref.datalen = *ser.len;
13533 ser_ref.data = (int8_t*)(ser.len + 1);
13534 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
13535 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13536 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13537 long ret_ref = (long)ret_var.inner;
13538 if (ret_var.is_owned) {
13544 int8_tArray get_1htlc_1redeemscript(void* ctx_TODO, uint32_t htlc, uint32_t keys) {
13545 LDKHTLCOutputInCommitment htlc_conv;
13546 htlc_conv.inner = (void*)(htlc & (~1));
13547 htlc_conv.is_owned = false;
13548 LDKTxCreationKeys keys_conv;
13549 keys_conv.inner = (void*)(keys & (~1));
13550 keys_conv.is_owned = false;
13551 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
13552 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13553 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13554 CVec_u8Z_free(arg_var);
13558 int8_tArray make_1funding_1redeemscript(void* ctx_TODO, int8_tArray broadcaster, int8_tArray countersignatory) {
13559 LDKPublicKey broadcaster_ref;
13560 CHECK(*broadcaster.len == 33);
13561 memcpy(broadcaster_ref.compressed_form, broadcaster.len + 1, 33);
13562 LDKPublicKey countersignatory_ref;
13563 CHECK(*countersignatory.len == 33);
13564 memcpy(countersignatory_ref.compressed_form, countersignatory.len + 1, 33);
13565 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13566 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13567 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13568 CVec_u8Z_free(arg_var);
13572 int8_tArray build_1htlc_1transaction(void* ctx_TODO, int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
13573 unsigned char prev_hash_arr[32];
13574 CHECK(*prev_hash.len == 32);
13575 memcpy(prev_hash_arr, prev_hash.len + 1, 32);
13576 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13577 LDKHTLCOutputInCommitment htlc_conv;
13578 htlc_conv.inner = (void*)(htlc & (~1));
13579 htlc_conv.is_owned = false;
13580 LDKPublicKey broadcaster_delayed_payment_key_ref;
13581 CHECK(*broadcaster_delayed_payment_key.len == 33);
13582 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.len + 1, 33);
13583 LDKPublicKey revocation_key_ref;
13584 CHECK(*revocation_key.len == 33);
13585 memcpy(revocation_key_ref.compressed_form, revocation_key.len + 1, 33);
13586 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13587 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13588 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13589 Transaction_free(arg_var);
13593 void ChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
13594 LDKChannelTransactionParameters this_ptr_conv;
13595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13597 ChannelTransactionParameters_free(this_ptr_conv);
13600 uint32_t ChannelTransactionParameters_1clone(void* ctx_TODO, uint32_t orig) {
13601 LDKChannelTransactionParameters orig_conv;
13602 orig_conv.inner = (void*)(orig & (~1));
13603 orig_conv.is_owned = false;
13604 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
13605 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13606 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13607 long ret_ref = (long)ret_var.inner;
13608 if (ret_var.is_owned) {
13614 uint32_t ChannelTransactionParameters_1get_1holder_1pubkeys(void* ctx_TODO, uint32_t this_ptr) {
13615 LDKChannelTransactionParameters this_ptr_conv;
13616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13617 this_ptr_conv.is_owned = false;
13618 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
13619 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13620 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13621 long ret_ref = (long)ret_var.inner;
13622 if (ret_var.is_owned) {
13628 void ChannelTransactionParameters_1set_1holder_1pubkeys(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13629 LDKChannelTransactionParameters this_ptr_conv;
13630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13631 this_ptr_conv.is_owned = false;
13632 LDKChannelPublicKeys val_conv;
13633 val_conv.inner = (void*)(val & (~1));
13634 val_conv.is_owned = (val & 1) || (val == 0);
13635 if (val_conv.inner != NULL)
13636 val_conv = ChannelPublicKeys_clone(&val_conv);
13637 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
13640 int16_t ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr) {
13641 LDKChannelTransactionParameters this_ptr_conv;
13642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13643 this_ptr_conv.is_owned = false;
13644 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
13648 void ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
13649 LDKChannelTransactionParameters this_ptr_conv;
13650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13651 this_ptr_conv.is_owned = false;
13652 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
13655 jboolean ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(void* ctx_TODO, uint32_t this_ptr) {
13656 LDKChannelTransactionParameters this_ptr_conv;
13657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13658 this_ptr_conv.is_owned = false;
13659 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
13663 void ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
13664 LDKChannelTransactionParameters this_ptr_conv;
13665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13666 this_ptr_conv.is_owned = false;
13667 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
13670 uint32_t ChannelTransactionParameters_1get_1counterparty_1parameters(void* ctx_TODO, uint32_t this_ptr) {
13671 LDKChannelTransactionParameters this_ptr_conv;
13672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13673 this_ptr_conv.is_owned = false;
13674 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
13675 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13676 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13677 long ret_ref = (long)ret_var.inner;
13678 if (ret_var.is_owned) {
13684 void ChannelTransactionParameters_1set_1counterparty_1parameters(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13685 LDKChannelTransactionParameters this_ptr_conv;
13686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13687 this_ptr_conv.is_owned = false;
13688 LDKCounterpartyChannelTransactionParameters val_conv;
13689 val_conv.inner = (void*)(val & (~1));
13690 val_conv.is_owned = (val & 1) || (val == 0);
13691 if (val_conv.inner != NULL)
13692 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
13693 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
13696 uint32_t ChannelTransactionParameters_1get_1funding_1outpoint(void* ctx_TODO, uint32_t this_ptr) {
13697 LDKChannelTransactionParameters this_ptr_conv;
13698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13699 this_ptr_conv.is_owned = false;
13700 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
13701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13703 long ret_ref = (long)ret_var.inner;
13704 if (ret_var.is_owned) {
13710 void ChannelTransactionParameters_1set_1funding_1outpoint(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13711 LDKChannelTransactionParameters this_ptr_conv;
13712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13713 this_ptr_conv.is_owned = false;
13714 LDKOutPoint val_conv;
13715 val_conv.inner = (void*)(val & (~1));
13716 val_conv.is_owned = (val & 1) || (val == 0);
13717 if (val_conv.inner != NULL)
13718 val_conv = OutPoint_clone(&val_conv);
13719 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
13722 uint32_t ChannelTransactionParameters_1new(void* ctx_TODO, uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg) {
13723 LDKChannelPublicKeys holder_pubkeys_arg_conv;
13724 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
13725 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
13726 if (holder_pubkeys_arg_conv.inner != NULL)
13727 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
13728 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
13729 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
13730 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
13731 if (counterparty_parameters_arg_conv.inner != NULL)
13732 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
13733 LDKOutPoint funding_outpoint_arg_conv;
13734 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
13735 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
13736 if (funding_outpoint_arg_conv.inner != NULL)
13737 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
13738 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);
13739 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13740 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13741 long ret_ref = (long)ret_var.inner;
13742 if (ret_var.is_owned) {
13748 void CounterpartyChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
13749 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13752 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
13755 uint32_t CounterpartyChannelTransactionParameters_1clone(void* ctx_TODO, uint32_t orig) {
13756 LDKCounterpartyChannelTransactionParameters orig_conv;
13757 orig_conv.inner = (void*)(orig & (~1));
13758 orig_conv.is_owned = false;
13759 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
13760 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13761 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13762 long ret_ref = (long)ret_var.inner;
13763 if (ret_var.is_owned) {
13769 uint32_t CounterpartyChannelTransactionParameters_1get_1pubkeys(void* ctx_TODO, uint32_t this_ptr) {
13770 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13772 this_ptr_conv.is_owned = false;
13773 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
13774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13776 long ret_ref = (long)ret_var.inner;
13777 if (ret_var.is_owned) {
13783 void CounterpartyChannelTransactionParameters_1set_1pubkeys(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
13784 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13786 this_ptr_conv.is_owned = false;
13787 LDKChannelPublicKeys val_conv;
13788 val_conv.inner = (void*)(val & (~1));
13789 val_conv.is_owned = (val & 1) || (val == 0);
13790 if (val_conv.inner != NULL)
13791 val_conv = ChannelPublicKeys_clone(&val_conv);
13792 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
13795 int16_t CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr) {
13796 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13798 this_ptr_conv.is_owned = false;
13799 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
13803 void CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
13804 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
13805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13806 this_ptr_conv.is_owned = false;
13807 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
13810 uint32_t CounterpartyChannelTransactionParameters_1new(void* ctx_TODO, uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
13811 LDKChannelPublicKeys pubkeys_arg_conv;
13812 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
13813 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
13814 if (pubkeys_arg_conv.inner != NULL)
13815 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
13816 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
13817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13819 long ret_ref = (long)ret_var.inner;
13820 if (ret_var.is_owned) {
13826 jboolean ChannelTransactionParameters_1is_1populated(void* ctx_TODO, uint32_t this_arg) {
13827 LDKChannelTransactionParameters this_arg_conv;
13828 this_arg_conv.inner = (void*)(this_arg & (~1));
13829 this_arg_conv.is_owned = false;
13830 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
13834 uint32_t ChannelTransactionParameters_1as_1holder_1broadcastable(void* ctx_TODO, uint32_t this_arg) {
13835 LDKChannelTransactionParameters this_arg_conv;
13836 this_arg_conv.inner = (void*)(this_arg & (~1));
13837 this_arg_conv.is_owned = false;
13838 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
13839 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13840 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13841 long ret_ref = (long)ret_var.inner;
13842 if (ret_var.is_owned) {
13848 uint32_t ChannelTransactionParameters_1as_1counterparty_1broadcastable(void* ctx_TODO, uint32_t this_arg) {
13849 LDKChannelTransactionParameters this_arg_conv;
13850 this_arg_conv.inner = (void*)(this_arg & (~1));
13851 this_arg_conv.is_owned = false;
13852 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
13853 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13854 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13855 long ret_ref = (long)ret_var.inner;
13856 if (ret_var.is_owned) {
13862 int8_tArray CounterpartyChannelTransactionParameters_1write(void* ctx_TODO, uint32_t obj) {
13863 LDKCounterpartyChannelTransactionParameters obj_conv;
13864 obj_conv.inner = (void*)(obj & (~1));
13865 obj_conv.is_owned = false;
13866 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
13867 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13868 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13869 CVec_u8Z_free(arg_var);
13873 uint32_t CounterpartyChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
13874 LDKu8slice ser_ref;
13875 ser_ref.datalen = *ser.len;
13876 ser_ref.data = (int8_t*)(ser.len + 1);
13877 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
13878 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13879 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13880 long ret_ref = (long)ret_var.inner;
13881 if (ret_var.is_owned) {
13887 int8_tArray ChannelTransactionParameters_1write(void* ctx_TODO, uint32_t obj) {
13888 LDKChannelTransactionParameters obj_conv;
13889 obj_conv.inner = (void*)(obj & (~1));
13890 obj_conv.is_owned = false;
13891 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
13892 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
13893 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
13894 CVec_u8Z_free(arg_var);
13898 uint32_t ChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
13899 LDKu8slice ser_ref;
13900 ser_ref.datalen = *ser.len;
13901 ser_ref.data = (int8_t*)(ser.len + 1);
13902 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
13903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13905 long ret_ref = (long)ret_var.inner;
13906 if (ret_var.is_owned) {
13912 void DirectedChannelTransactionParameters_1free(void* ctx_TODO, uint32_t this_ptr) {
13913 LDKDirectedChannelTransactionParameters this_ptr_conv;
13914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13916 DirectedChannelTransactionParameters_free(this_ptr_conv);
13919 uint32_t DirectedChannelTransactionParameters_1broadcaster_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
13920 LDKDirectedChannelTransactionParameters this_arg_conv;
13921 this_arg_conv.inner = (void*)(this_arg & (~1));
13922 this_arg_conv.is_owned = false;
13923 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
13924 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13925 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13926 long ret_ref = (long)ret_var.inner;
13927 if (ret_var.is_owned) {
13933 uint32_t DirectedChannelTransactionParameters_1countersignatory_1pubkeys(void* ctx_TODO, uint32_t this_arg) {
13934 LDKDirectedChannelTransactionParameters this_arg_conv;
13935 this_arg_conv.inner = (void*)(this_arg & (~1));
13936 this_arg_conv.is_owned = false;
13937 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
13938 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13939 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13940 long ret_ref = (long)ret_var.inner;
13941 if (ret_var.is_owned) {
13947 int16_t DirectedChannelTransactionParameters_1contest_1delay(void* ctx_TODO, uint32_t this_arg) {
13948 LDKDirectedChannelTransactionParameters this_arg_conv;
13949 this_arg_conv.inner = (void*)(this_arg & (~1));
13950 this_arg_conv.is_owned = false;
13951 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
13955 jboolean DirectedChannelTransactionParameters_1is_1outbound(void* ctx_TODO, uint32_t this_arg) {
13956 LDKDirectedChannelTransactionParameters this_arg_conv;
13957 this_arg_conv.inner = (void*)(this_arg & (~1));
13958 this_arg_conv.is_owned = false;
13959 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
13963 uint32_t DirectedChannelTransactionParameters_1funding_1outpoint(void* ctx_TODO, uint32_t this_arg) {
13964 LDKDirectedChannelTransactionParameters this_arg_conv;
13965 this_arg_conv.inner = (void*)(this_arg & (~1));
13966 this_arg_conv.is_owned = false;
13967 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
13968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13970 long ret_ref = (long)ret_var.inner;
13971 if (ret_var.is_owned) {
13977 void HolderCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
13978 LDKHolderCommitmentTransaction this_ptr_conv;
13979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13981 HolderCommitmentTransaction_free(this_ptr_conv);
13984 uint32_t HolderCommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
13985 LDKHolderCommitmentTransaction orig_conv;
13986 orig_conv.inner = (void*)(orig & (~1));
13987 orig_conv.is_owned = false;
13988 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13989 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13990 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13991 long ret_ref = (long)ret_var.inner;
13992 if (ret_var.is_owned) {
13998 int8_tArray HolderCommitmentTransaction_1get_1counterparty_1sig(void* ctx_TODO, uint32_t this_ptr) {
13999 LDKHolderCommitmentTransaction this_ptr_conv;
14000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14001 this_ptr_conv.is_owned = false;
14002 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
14003 memcpy(arg_arr.len + 1, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
14007 void HolderCommitmentTransaction_1set_1counterparty_1sig(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14008 LDKHolderCommitmentTransaction this_ptr_conv;
14009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14010 this_ptr_conv.is_owned = false;
14011 LDKSignature val_ref;
14012 CHECK(*val.len == 64);
14013 memcpy(val_ref.compact_form, val.len + 1, 64);
14014 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
14017 void HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(void* ctx_TODO, uint32_t this_ptr, ptrArray val) {
14018 LDKHolderCommitmentTransaction this_ptr_conv;
14019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14020 this_ptr_conv.is_owned = false;
14021 LDKCVec_SignatureZ val_constr;
14022 val_constr.datalen = *val.len;
14023 if (val_constr.datalen > 0)
14024 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14026 val_constr.data = NULL;
14027 int8_tArray* val_vals = (int8_tArray*)(val.len + 1);
14028 for (size_t m = 0; m < val_constr.datalen; m++) {
14029 int8_tArray arr_conv_12 = val_vals[m];
14030 LDKSignature arr_conv_12_ref;
14031 CHECK(*arr_conv_12.len == 64);
14032 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
14033 val_constr.data[m] = arr_conv_12_ref;
14035 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
14038 int8_tArray HolderCommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
14039 LDKHolderCommitmentTransaction obj_conv;
14040 obj_conv.inner = (void*)(obj & (~1));
14041 obj_conv.is_owned = false;
14042 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
14043 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
14044 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
14045 CVec_u8Z_free(arg_var);
14049 uint32_t HolderCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
14050 LDKu8slice ser_ref;
14051 ser_ref.datalen = *ser.len;
14052 ser_ref.data = (int8_t*)(ser.len + 1);
14053 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
14054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14056 long ret_ref = (long)ret_var.inner;
14057 if (ret_var.is_owned) {
14063 uint32_t HolderCommitmentTransaction_1new(void* ctx_TODO, uint32_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
14064 LDKCommitmentTransaction commitment_tx_conv;
14065 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
14066 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
14067 if (commitment_tx_conv.inner != NULL)
14068 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
14069 LDKSignature counterparty_sig_ref;
14070 CHECK(*counterparty_sig.len == 64);
14071 memcpy(counterparty_sig_ref.compact_form, counterparty_sig.len + 1, 64);
14072 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
14073 counterparty_htlc_sigs_constr.datalen = *counterparty_htlc_sigs.len;
14074 if (counterparty_htlc_sigs_constr.datalen > 0)
14075 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14077 counterparty_htlc_sigs_constr.data = NULL;
14078 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs.len + 1);
14079 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
14080 int8_tArray arr_conv_12 = counterparty_htlc_sigs_vals[m];
14081 LDKSignature arr_conv_12_ref;
14082 CHECK(*arr_conv_12.len == 64);
14083 memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
14084 counterparty_htlc_sigs_constr.data[m] = arr_conv_12_ref;
14086 LDKPublicKey holder_funding_key_ref;
14087 CHECK(*holder_funding_key.len == 33);
14088 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key.len + 1, 33);
14089 LDKPublicKey counterparty_funding_key_ref;
14090 CHECK(*counterparty_funding_key.len == 33);
14091 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key.len + 1, 33);
14092 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
14093 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14094 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14095 long ret_ref = (long)ret_var.inner;
14096 if (ret_var.is_owned) {
14102 void BuiltCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
14103 LDKBuiltCommitmentTransaction this_ptr_conv;
14104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14106 BuiltCommitmentTransaction_free(this_ptr_conv);
14109 uint32_t BuiltCommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
14110 LDKBuiltCommitmentTransaction orig_conv;
14111 orig_conv.inner = (void*)(orig & (~1));
14112 orig_conv.is_owned = false;
14113 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
14114 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14115 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14116 long ret_ref = (long)ret_var.inner;
14117 if (ret_var.is_owned) {
14123 int8_tArray BuiltCommitmentTransaction_1get_1transaction(void* ctx_TODO, uint32_t this_ptr) {
14124 LDKBuiltCommitmentTransaction this_ptr_conv;
14125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14126 this_ptr_conv.is_owned = false;
14127 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
14128 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
14129 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
14130 Transaction_free(arg_var);
14134 void BuiltCommitmentTransaction_1set_1transaction(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14135 LDKBuiltCommitmentTransaction this_ptr_conv;
14136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14137 this_ptr_conv.is_owned = false;
14138 LDKTransaction val_ref;
14139 val_ref.datalen = *val.len;
14140 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
14141 memcpy(val_ref.data, val.len + 1, val_ref.datalen);
14142 val_ref.data_is_owned = true;
14143 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
14146 int8_tArray BuiltCommitmentTransaction_1get_1txid(void* ctx_TODO, uint32_t this_ptr) {
14147 LDKBuiltCommitmentTransaction this_ptr_conv;
14148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14149 this_ptr_conv.is_owned = false;
14150 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
14151 memcpy(ret_arr.len + 1, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
14155 void BuiltCommitmentTransaction_1set_1txid(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14156 LDKBuiltCommitmentTransaction this_ptr_conv;
14157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14158 this_ptr_conv.is_owned = false;
14159 LDKThirtyTwoBytes val_ref;
14160 CHECK(*val.len == 32);
14161 memcpy(val_ref.data, val.len + 1, 32);
14162 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
14165 uint32_t BuiltCommitmentTransaction_1new(void* ctx_TODO, int8_tArray transaction_arg, int8_tArray txid_arg) {
14166 LDKTransaction transaction_arg_ref;
14167 transaction_arg_ref.datalen = *transaction_arg.len;
14168 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
14169 memcpy(transaction_arg_ref.data, transaction_arg.len + 1, transaction_arg_ref.datalen);
14170 transaction_arg_ref.data_is_owned = true;
14171 LDKThirtyTwoBytes txid_arg_ref;
14172 CHECK(*txid_arg.len == 32);
14173 memcpy(txid_arg_ref.data, txid_arg.len + 1, 32);
14174 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
14175 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14176 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14177 long ret_ref = (long)ret_var.inner;
14178 if (ret_var.is_owned) {
14184 int8_tArray BuiltCommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
14185 LDKBuiltCommitmentTransaction obj_conv;
14186 obj_conv.inner = (void*)(obj & (~1));
14187 obj_conv.is_owned = false;
14188 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
14189 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
14190 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
14191 CVec_u8Z_free(arg_var);
14195 uint32_t BuiltCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
14196 LDKu8slice ser_ref;
14197 ser_ref.datalen = *ser.len;
14198 ser_ref.data = (int8_t*)(ser.len + 1);
14199 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
14200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14202 long ret_ref = (long)ret_var.inner;
14203 if (ret_var.is_owned) {
14209 int8_tArray BuiltCommitmentTransaction_1get_1sighash_1all(void* ctx_TODO, uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
14210 LDKBuiltCommitmentTransaction this_arg_conv;
14211 this_arg_conv.inner = (void*)(this_arg & (~1));
14212 this_arg_conv.is_owned = false;
14213 LDKu8slice funding_redeemscript_ref;
14214 funding_redeemscript_ref.datalen = *funding_redeemscript.len;
14215 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript.len + 1);
14216 int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
14217 memcpy(arg_arr.len + 1, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
14221 int8_tArray BuiltCommitmentTransaction_1sign(void* ctx_TODO, uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
14222 LDKBuiltCommitmentTransaction this_arg_conv;
14223 this_arg_conv.inner = (void*)(this_arg & (~1));
14224 this_arg_conv.is_owned = false;
14225 unsigned char funding_key_arr[32];
14226 CHECK(*funding_key.len == 32);
14227 memcpy(funding_key_arr, funding_key.len + 1, 32);
14228 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
14229 LDKu8slice funding_redeemscript_ref;
14230 funding_redeemscript_ref.datalen = *funding_redeemscript.len;
14231 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript.len + 1);
14232 int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
14233 memcpy(arg_arr.len + 1, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
14237 void CommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
14238 LDKCommitmentTransaction this_ptr_conv;
14239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14241 CommitmentTransaction_free(this_ptr_conv);
14244 uint32_t CommitmentTransaction_1clone(void* ctx_TODO, uint32_t orig) {
14245 LDKCommitmentTransaction orig_conv;
14246 orig_conv.inner = (void*)(orig & (~1));
14247 orig_conv.is_owned = false;
14248 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
14249 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14250 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14251 long ret_ref = (long)ret_var.inner;
14252 if (ret_var.is_owned) {
14258 int8_tArray CommitmentTransaction_1write(void* ctx_TODO, uint32_t obj) {
14259 LDKCommitmentTransaction obj_conv;
14260 obj_conv.inner = (void*)(obj & (~1));
14261 obj_conv.is_owned = false;
14262 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
14263 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
14264 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
14265 CVec_u8Z_free(arg_var);
14269 uint32_t CommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
14270 LDKu8slice ser_ref;
14271 ser_ref.datalen = *ser.len;
14272 ser_ref.data = (int8_t*)(ser.len + 1);
14273 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
14274 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14275 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14276 long ret_ref = (long)ret_var.inner;
14277 if (ret_var.is_owned) {
14283 int64_t CommitmentTransaction_1commitment_1number(void* ctx_TODO, uint32_t this_arg) {
14284 LDKCommitmentTransaction this_arg_conv;
14285 this_arg_conv.inner = (void*)(this_arg & (~1));
14286 this_arg_conv.is_owned = false;
14287 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
14291 int64_t CommitmentTransaction_1to_1broadcaster_1value_1sat(void* ctx_TODO, uint32_t this_arg) {
14292 LDKCommitmentTransaction this_arg_conv;
14293 this_arg_conv.inner = (void*)(this_arg & (~1));
14294 this_arg_conv.is_owned = false;
14295 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
14299 int64_t CommitmentTransaction_1to_1countersignatory_1value_1sat(void* ctx_TODO, uint32_t this_arg) {
14300 LDKCommitmentTransaction this_arg_conv;
14301 this_arg_conv.inner = (void*)(this_arg & (~1));
14302 this_arg_conv.is_owned = false;
14303 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
14307 int32_t CommitmentTransaction_1feerate_1per_1kw(void* ctx_TODO, uint32_t this_arg) {
14308 LDKCommitmentTransaction this_arg_conv;
14309 this_arg_conv.inner = (void*)(this_arg & (~1));
14310 this_arg_conv.is_owned = false;
14311 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
14315 uint32_t CommitmentTransaction_1trust(void* ctx_TODO, uint32_t this_arg) {
14316 LDKCommitmentTransaction this_arg_conv;
14317 this_arg_conv.inner = (void*)(this_arg & (~1));
14318 this_arg_conv.is_owned = false;
14319 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
14320 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14321 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14322 long ret_ref = (long)ret_var.inner;
14323 if (ret_var.is_owned) {
14329 uint32_t CommitmentTransaction_1verify(void* ctx_TODO, uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
14330 LDKCommitmentTransaction this_arg_conv;
14331 this_arg_conv.inner = (void*)(this_arg & (~1));
14332 this_arg_conv.is_owned = false;
14333 LDKDirectedChannelTransactionParameters channel_parameters_conv;
14334 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
14335 channel_parameters_conv.is_owned = false;
14336 LDKChannelPublicKeys broadcaster_keys_conv;
14337 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
14338 broadcaster_keys_conv.is_owned = false;
14339 LDKChannelPublicKeys countersignatory_keys_conv;
14340 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
14341 countersignatory_keys_conv.is_owned = false;
14342 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14343 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
14344 return (long)ret_conv;
14347 void TrustedCommitmentTransaction_1free(void* ctx_TODO, uint32_t this_ptr) {
14348 LDKTrustedCommitmentTransaction this_ptr_conv;
14349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14351 TrustedCommitmentTransaction_free(this_ptr_conv);
14354 int8_tArray TrustedCommitmentTransaction_1txid(void* ctx_TODO, uint32_t this_arg) {
14355 LDKTrustedCommitmentTransaction this_arg_conv;
14356 this_arg_conv.inner = (void*)(this_arg & (~1));
14357 this_arg_conv.is_owned = false;
14358 int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
14359 memcpy(arg_arr.len + 1, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
14363 uint32_t TrustedCommitmentTransaction_1built_1transaction(void* ctx_TODO, uint32_t this_arg) {
14364 LDKTrustedCommitmentTransaction this_arg_conv;
14365 this_arg_conv.inner = (void*)(this_arg & (~1));
14366 this_arg_conv.is_owned = false;
14367 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
14368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14370 long ret_ref = (long)ret_var.inner;
14371 if (ret_var.is_owned) {
14377 uint32_t TrustedCommitmentTransaction_1keys(void* ctx_TODO, uint32_t this_arg) {
14378 LDKTrustedCommitmentTransaction this_arg_conv;
14379 this_arg_conv.inner = (void*)(this_arg & (~1));
14380 this_arg_conv.is_owned = false;
14381 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
14382 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14383 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14384 long ret_ref = (long)ret_var.inner;
14385 if (ret_var.is_owned) {
14391 uint32_t TrustedCommitmentTransaction_1get_1htlc_1sigs(void* ctx_TODO, uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
14392 LDKTrustedCommitmentTransaction this_arg_conv;
14393 this_arg_conv.inner = (void*)(this_arg & (~1));
14394 this_arg_conv.is_owned = false;
14395 unsigned char htlc_base_key_arr[32];
14396 CHECK(*htlc_base_key.len == 32);
14397 memcpy(htlc_base_key_arr, htlc_base_key.len + 1, 32);
14398 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
14399 LDKDirectedChannelTransactionParameters channel_parameters_conv;
14400 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
14401 channel_parameters_conv.is_owned = false;
14402 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14403 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
14404 return (long)ret_conv;
14407 int64_t get_1commitment_1transaction_1number_1obscure_1factor(void* ctx_TODO, int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
14408 LDKPublicKey broadcaster_payment_basepoint_ref;
14409 CHECK(*broadcaster_payment_basepoint.len == 33);
14410 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint.len + 1, 33);
14411 LDKPublicKey countersignatory_payment_basepoint_ref;
14412 CHECK(*countersignatory_payment_basepoint.len == 33);
14413 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint.len + 1, 33);
14414 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
14418 void InitFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
14419 LDKInitFeatures this_ptr_conv;
14420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14422 InitFeatures_free(this_ptr_conv);
14425 void NodeFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
14426 LDKNodeFeatures this_ptr_conv;
14427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14429 NodeFeatures_free(this_ptr_conv);
14432 void ChannelFeatures_1free(void* ctx_TODO, uint32_t this_ptr) {
14433 LDKChannelFeatures this_ptr_conv;
14434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14436 ChannelFeatures_free(this_ptr_conv);
14439 void RouteHop_1free(void* ctx_TODO, uint32_t this_ptr) {
14440 LDKRouteHop this_ptr_conv;
14441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14443 RouteHop_free(this_ptr_conv);
14446 uint32_t RouteHop_1clone(void* ctx_TODO, uint32_t orig) {
14447 LDKRouteHop orig_conv;
14448 orig_conv.inner = (void*)(orig & (~1));
14449 orig_conv.is_owned = false;
14450 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
14451 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14452 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14453 long ret_ref = (long)ret_var.inner;
14454 if (ret_var.is_owned) {
14460 int8_tArray RouteHop_1get_1pubkey(void* ctx_TODO, uint32_t this_ptr) {
14461 LDKRouteHop this_ptr_conv;
14462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14463 this_ptr_conv.is_owned = false;
14464 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
14465 memcpy(arg_arr.len + 1, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
14469 void RouteHop_1set_1pubkey(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14470 LDKRouteHop this_ptr_conv;
14471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14472 this_ptr_conv.is_owned = false;
14473 LDKPublicKey val_ref;
14474 CHECK(*val.len == 33);
14475 memcpy(val_ref.compressed_form, val.len + 1, 33);
14476 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
14479 uint32_t RouteHop_1get_1node_1features(void* ctx_TODO, uint32_t this_ptr) {
14480 LDKRouteHop this_ptr_conv;
14481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14482 this_ptr_conv.is_owned = false;
14483 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
14484 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14485 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14486 long ret_ref = (long)ret_var.inner;
14487 if (ret_var.is_owned) {
14493 void RouteHop_1set_1node_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14494 LDKRouteHop this_ptr_conv;
14495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14496 this_ptr_conv.is_owned = false;
14497 LDKNodeFeatures val_conv;
14498 val_conv.inner = (void*)(val & (~1));
14499 val_conv.is_owned = (val & 1) || (val == 0);
14500 // Warning: we may need a move here but can't clone!
14501 RouteHop_set_node_features(&this_ptr_conv, val_conv);
14504 int64_t RouteHop_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
14505 LDKRouteHop this_ptr_conv;
14506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14507 this_ptr_conv.is_owned = false;
14508 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
14512 void RouteHop_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14513 LDKRouteHop this_ptr_conv;
14514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14515 this_ptr_conv.is_owned = false;
14516 RouteHop_set_short_channel_id(&this_ptr_conv, val);
14519 uint32_t RouteHop_1get_1channel_1features(void* ctx_TODO, uint32_t this_ptr) {
14520 LDKRouteHop this_ptr_conv;
14521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14522 this_ptr_conv.is_owned = false;
14523 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
14524 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14525 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14526 long ret_ref = (long)ret_var.inner;
14527 if (ret_var.is_owned) {
14533 void RouteHop_1set_1channel_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14534 LDKRouteHop this_ptr_conv;
14535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14536 this_ptr_conv.is_owned = false;
14537 LDKChannelFeatures val_conv;
14538 val_conv.inner = (void*)(val & (~1));
14539 val_conv.is_owned = (val & 1) || (val == 0);
14540 // Warning: we may need a move here but can't clone!
14541 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
14544 int64_t RouteHop_1get_1fee_1msat(void* ctx_TODO, uint32_t this_ptr) {
14545 LDKRouteHop this_ptr_conv;
14546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14547 this_ptr_conv.is_owned = false;
14548 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
14552 void RouteHop_1set_1fee_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14553 LDKRouteHop this_ptr_conv;
14554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14555 this_ptr_conv.is_owned = false;
14556 RouteHop_set_fee_msat(&this_ptr_conv, val);
14559 int32_t RouteHop_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
14560 LDKRouteHop this_ptr_conv;
14561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14562 this_ptr_conv.is_owned = false;
14563 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
14567 void RouteHop_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
14568 LDKRouteHop this_ptr_conv;
14569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14570 this_ptr_conv.is_owned = false;
14571 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
14574 uint32_t RouteHop_1new(void* ctx_TODO, int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
14575 LDKPublicKey pubkey_arg_ref;
14576 CHECK(*pubkey_arg.len == 33);
14577 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg.len + 1, 33);
14578 LDKNodeFeatures node_features_arg_conv;
14579 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
14580 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
14581 // Warning: we may need a move here but can't clone!
14582 LDKChannelFeatures channel_features_arg_conv;
14583 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
14584 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
14585 // Warning: we may need a move here but can't clone!
14586 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);
14587 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14588 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14589 long ret_ref = (long)ret_var.inner;
14590 if (ret_var.is_owned) {
14596 void Route_1free(void* ctx_TODO, uint32_t this_ptr) {
14597 LDKRoute this_ptr_conv;
14598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14600 Route_free(this_ptr_conv);
14603 uint32_t Route_1clone(void* ctx_TODO, uint32_t orig) {
14604 LDKRoute orig_conv;
14605 orig_conv.inner = (void*)(orig & (~1));
14606 orig_conv.is_owned = false;
14607 LDKRoute ret_var = Route_clone(&orig_conv);
14608 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14609 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14610 long ret_ref = (long)ret_var.inner;
14611 if (ret_var.is_owned) {
14617 void Route_1set_1paths(void* ctx_TODO, uint32_t this_ptr, ptrArray val) {
14618 LDKRoute this_ptr_conv;
14619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14620 this_ptr_conv.is_owned = false;
14621 LDKCVec_CVec_RouteHopZZ val_constr;
14622 val_constr.datalen = *val.len;
14623 if (val_constr.datalen > 0)
14624 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14626 val_constr.data = NULL;
14627 uint32_tArray* val_vals = (uint32_tArray*)(val.len + 1);
14628 for (size_t m = 0; m < val_constr.datalen; m++) {
14629 uint32_tArray arr_conv_12 = val_vals[m];
14630 LDKCVec_RouteHopZ arr_conv_12_constr;
14631 arr_conv_12_constr.datalen = *arr_conv_12.len;
14632 if (arr_conv_12_constr.datalen > 0)
14633 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14635 arr_conv_12_constr.data = NULL;
14636 uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12.len + 1);
14637 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
14638 uint32_t arr_conv_10 = arr_conv_12_vals[k];
14639 LDKRouteHop arr_conv_10_conv;
14640 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
14641 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
14642 if (arr_conv_10_conv.inner != NULL)
14643 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
14644 arr_conv_12_constr.data[k] = arr_conv_10_conv;
14646 val_constr.data[m] = arr_conv_12_constr;
14648 Route_set_paths(&this_ptr_conv, val_constr);
14651 uint32_t Route_1new(void* ctx_TODO, ptrArray paths_arg) {
14652 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
14653 paths_arg_constr.datalen = *paths_arg.len;
14654 if (paths_arg_constr.datalen > 0)
14655 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14657 paths_arg_constr.data = NULL;
14658 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg.len + 1);
14659 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
14660 uint32_tArray arr_conv_12 = paths_arg_vals[m];
14661 LDKCVec_RouteHopZ arr_conv_12_constr;
14662 arr_conv_12_constr.datalen = *arr_conv_12.len;
14663 if (arr_conv_12_constr.datalen > 0)
14664 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14666 arr_conv_12_constr.data = NULL;
14667 uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12.len + 1);
14668 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
14669 uint32_t arr_conv_10 = arr_conv_12_vals[k];
14670 LDKRouteHop arr_conv_10_conv;
14671 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
14672 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
14673 if (arr_conv_10_conv.inner != NULL)
14674 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
14675 arr_conv_12_constr.data[k] = arr_conv_10_conv;
14677 paths_arg_constr.data[m] = arr_conv_12_constr;
14679 LDKRoute ret_var = Route_new(paths_arg_constr);
14680 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14681 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14682 long ret_ref = (long)ret_var.inner;
14683 if (ret_var.is_owned) {
14689 int8_tArray Route_1write(void* ctx_TODO, uint32_t obj) {
14691 obj_conv.inner = (void*)(obj & (~1));
14692 obj_conv.is_owned = false;
14693 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
14694 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
14695 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
14696 CVec_u8Z_free(arg_var);
14700 uint32_t Route_1read(void* ctx_TODO, int8_tArray ser) {
14701 LDKu8slice ser_ref;
14702 ser_ref.datalen = *ser.len;
14703 ser_ref.data = (int8_t*)(ser.len + 1);
14704 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14705 *ret_conv = Route_read(ser_ref);
14706 return (long)ret_conv;
14709 void RouteHint_1free(void* ctx_TODO, uint32_t this_ptr) {
14710 LDKRouteHint this_ptr_conv;
14711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14712 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14713 RouteHint_free(this_ptr_conv);
14716 uint32_t RouteHint_1clone(void* ctx_TODO, uint32_t orig) {
14717 LDKRouteHint orig_conv;
14718 orig_conv.inner = (void*)(orig & (~1));
14719 orig_conv.is_owned = false;
14720 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
14721 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14722 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14723 long ret_ref = (long)ret_var.inner;
14724 if (ret_var.is_owned) {
14730 int8_tArray RouteHint_1get_1src_1node_1id(void* ctx_TODO, uint32_t this_ptr) {
14731 LDKRouteHint this_ptr_conv;
14732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14733 this_ptr_conv.is_owned = false;
14734 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
14735 memcpy(arg_arr.len + 1, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
14739 void RouteHint_1set_1src_1node_1id(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
14740 LDKRouteHint this_ptr_conv;
14741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14742 this_ptr_conv.is_owned = false;
14743 LDKPublicKey val_ref;
14744 CHECK(*val.len == 33);
14745 memcpy(val_ref.compressed_form, val.len + 1, 33);
14746 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
14749 int64_t RouteHint_1get_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr) {
14750 LDKRouteHint this_ptr_conv;
14751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14752 this_ptr_conv.is_owned = false;
14753 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
14757 void RouteHint_1set_1short_1channel_1id(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14758 LDKRouteHint this_ptr_conv;
14759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14760 this_ptr_conv.is_owned = false;
14761 RouteHint_set_short_channel_id(&this_ptr_conv, val);
14764 uint32_t RouteHint_1get_1fees(void* ctx_TODO, uint32_t this_ptr) {
14765 LDKRouteHint this_ptr_conv;
14766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14767 this_ptr_conv.is_owned = false;
14768 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
14769 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14770 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14771 long ret_ref = (long)ret_var.inner;
14772 if (ret_var.is_owned) {
14778 void RouteHint_1set_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
14779 LDKRouteHint this_ptr_conv;
14780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14781 this_ptr_conv.is_owned = false;
14782 LDKRoutingFees val_conv;
14783 val_conv.inner = (void*)(val & (~1));
14784 val_conv.is_owned = (val & 1) || (val == 0);
14785 if (val_conv.inner != NULL)
14786 val_conv = RoutingFees_clone(&val_conv);
14787 RouteHint_set_fees(&this_ptr_conv, val_conv);
14790 int16_t RouteHint_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
14791 LDKRouteHint this_ptr_conv;
14792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14793 this_ptr_conv.is_owned = false;
14794 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
14798 void RouteHint_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
14799 LDKRouteHint this_ptr_conv;
14800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14801 this_ptr_conv.is_owned = false;
14802 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
14805 int64_t RouteHint_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
14806 LDKRouteHint this_ptr_conv;
14807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14808 this_ptr_conv.is_owned = false;
14809 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
14813 void RouteHint_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
14814 LDKRouteHint this_ptr_conv;
14815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14816 this_ptr_conv.is_owned = false;
14817 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
14820 uint32_t RouteHint_1new(void* ctx_TODO, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg) {
14821 LDKPublicKey src_node_id_arg_ref;
14822 CHECK(*src_node_id_arg.len == 33);
14823 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg.len + 1, 33);
14824 LDKRoutingFees fees_arg_conv;
14825 fees_arg_conv.inner = (void*)(fees_arg & (~1));
14826 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
14827 if (fees_arg_conv.inner != NULL)
14828 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
14829 LDKRouteHint ret_var = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
14830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14832 long ret_ref = (long)ret_var.inner;
14833 if (ret_var.is_owned) {
14839 uint32_t get_1route(void* ctx_TODO, int8_tArray our_node_id, uint32_t network, int8_tArray target, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
14840 LDKPublicKey our_node_id_ref;
14841 CHECK(*our_node_id.len == 33);
14842 memcpy(our_node_id_ref.compressed_form, our_node_id.len + 1, 33);
14843 LDKNetworkGraph network_conv;
14844 network_conv.inner = (void*)(network & (~1));
14845 network_conv.is_owned = false;
14846 LDKPublicKey target_ref;
14847 CHECK(*target.len == 33);
14848 memcpy(target_ref.compressed_form, target.len + 1, 33);
14849 LDKCVec_ChannelDetailsZ first_hops_constr;
14850 first_hops_constr.datalen = *first_hops.len;
14851 if (first_hops_constr.datalen > 0)
14852 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14854 first_hops_constr.data = NULL;
14855 uint32_t* first_hops_vals = (uint32_t*)(first_hops.len + 1);
14856 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14857 uint32_t arr_conv_16 = first_hops_vals[q];
14858 LDKChannelDetails arr_conv_16_conv;
14859 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
14860 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
14861 first_hops_constr.data[q] = arr_conv_16_conv;
14863 LDKCVec_RouteHintZ last_hops_constr;
14864 last_hops_constr.datalen = *last_hops.len;
14865 if (last_hops_constr.datalen > 0)
14866 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
14868 last_hops_constr.data = NULL;
14869 uint32_t* last_hops_vals = (uint32_t*)(last_hops.len + 1);
14870 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
14871 uint32_t arr_conv_11 = last_hops_vals[l];
14872 LDKRouteHint arr_conv_11_conv;
14873 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
14874 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
14875 if (arr_conv_11_conv.inner != NULL)
14876 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
14877 last_hops_constr.data[l] = arr_conv_11_conv;
14879 LDKLogger logger_conv = *(LDKLogger*)logger;
14880 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14881 *ret_conv = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
14882 FREE(first_hops_constr.data);
14883 return (long)ret_conv;
14886 void NetworkGraph_1free(void* ctx_TODO, uint32_t this_ptr) {
14887 LDKNetworkGraph this_ptr_conv;
14888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14890 NetworkGraph_free(this_ptr_conv);
14893 void LockedNetworkGraph_1free(void* ctx_TODO, uint32_t this_ptr) {
14894 LDKLockedNetworkGraph this_ptr_conv;
14895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14897 LockedNetworkGraph_free(this_ptr_conv);
14900 void NetGraphMsgHandler_1free(void* ctx_TODO, uint32_t this_ptr) {
14901 LDKNetGraphMsgHandler this_ptr_conv;
14902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14904 NetGraphMsgHandler_free(this_ptr_conv);
14907 uint32_t NetGraphMsgHandler_1new(void* ctx_TODO, int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
14908 LDKThirtyTwoBytes genesis_hash_ref;
14909 CHECK(*genesis_hash.len == 32);
14910 memcpy(genesis_hash_ref.data, genesis_hash.len + 1, 32);
14911 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
14912 LDKLogger logger_conv = *(LDKLogger*)logger;
14913 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
14914 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14915 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14916 long ret_ref = (long)ret_var.inner;
14917 if (ret_var.is_owned) {
14923 uint32_t NetGraphMsgHandler_1from_1net_1graph(void* ctx_TODO, uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
14924 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
14925 LDKLogger logger_conv = *(LDKLogger*)logger;
14926 LDKNetworkGraph network_graph_conv;
14927 network_graph_conv.inner = (void*)(network_graph & (~1));
14928 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
14929 // Warning: we may need a move here but can't clone!
14930 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
14931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14933 long ret_ref = (long)ret_var.inner;
14934 if (ret_var.is_owned) {
14940 uint32_t NetGraphMsgHandler_1read_1locked_1graph(void* ctx_TODO, uint32_t this_arg) {
14941 LDKNetGraphMsgHandler this_arg_conv;
14942 this_arg_conv.inner = (void*)(this_arg & (~1));
14943 this_arg_conv.is_owned = false;
14944 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
14945 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14946 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14947 long ret_ref = (long)ret_var.inner;
14948 if (ret_var.is_owned) {
14954 uint32_t LockedNetworkGraph_1graph(void* ctx_TODO, uint32_t this_arg) {
14955 LDKLockedNetworkGraph this_arg_conv;
14956 this_arg_conv.inner = (void*)(this_arg & (~1));
14957 this_arg_conv.is_owned = false;
14958 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
14959 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14960 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14961 long ret_ref = (long)ret_var.inner;
14962 if (ret_var.is_owned) {
14968 uint32_t NetGraphMsgHandler_1as_1RoutingMessageHandler(void* ctx_TODO, uint32_t this_arg) {
14969 LDKNetGraphMsgHandler this_arg_conv;
14970 this_arg_conv.inner = (void*)(this_arg & (~1));
14971 this_arg_conv.is_owned = false;
14972 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
14973 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
14977 uint32_t NetGraphMsgHandler_1as_1MessageSendEventsProvider(void* ctx_TODO, uint32_t this_arg) {
14978 LDKNetGraphMsgHandler this_arg_conv;
14979 this_arg_conv.inner = (void*)(this_arg & (~1));
14980 this_arg_conv.is_owned = false;
14981 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
14982 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
14986 void DirectionalChannelInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
14987 LDKDirectionalChannelInfo this_ptr_conv;
14988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14990 DirectionalChannelInfo_free(this_ptr_conv);
14993 int32_t DirectionalChannelInfo_1get_1last_1update(void* ctx_TODO, uint32_t this_ptr) {
14994 LDKDirectionalChannelInfo this_ptr_conv;
14995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14996 this_ptr_conv.is_owned = false;
14997 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
15001 void DirectionalChannelInfo_1set_1last_1update(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15002 LDKDirectionalChannelInfo this_ptr_conv;
15003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15004 this_ptr_conv.is_owned = false;
15005 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
15008 jboolean DirectionalChannelInfo_1get_1enabled(void* ctx_TODO, uint32_t this_ptr) {
15009 LDKDirectionalChannelInfo this_ptr_conv;
15010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15011 this_ptr_conv.is_owned = false;
15012 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
15016 void DirectionalChannelInfo_1set_1enabled(void* ctx_TODO, uint32_t this_ptr, jboolean val) {
15017 LDKDirectionalChannelInfo this_ptr_conv;
15018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15019 this_ptr_conv.is_owned = false;
15020 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
15023 int16_t DirectionalChannelInfo_1get_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr) {
15024 LDKDirectionalChannelInfo this_ptr_conv;
15025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15026 this_ptr_conv.is_owned = false;
15027 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
15031 void DirectionalChannelInfo_1set_1cltv_1expiry_1delta(void* ctx_TODO, uint32_t this_ptr, int16_t val) {
15032 LDKDirectionalChannelInfo this_ptr_conv;
15033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15034 this_ptr_conv.is_owned = false;
15035 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
15038 int64_t DirectionalChannelInfo_1get_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr) {
15039 LDKDirectionalChannelInfo this_ptr_conv;
15040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15041 this_ptr_conv.is_owned = false;
15042 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
15046 void DirectionalChannelInfo_1set_1htlc_1minimum_1msat(void* ctx_TODO, uint32_t this_ptr, int64_t val) {
15047 LDKDirectionalChannelInfo this_ptr_conv;
15048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15049 this_ptr_conv.is_owned = false;
15050 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
15053 uint32_t DirectionalChannelInfo_1get_1fees(void* ctx_TODO, uint32_t this_ptr) {
15054 LDKDirectionalChannelInfo this_ptr_conv;
15055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15056 this_ptr_conv.is_owned = false;
15057 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
15058 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15059 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15060 long ret_ref = (long)ret_var.inner;
15061 if (ret_var.is_owned) {
15067 void DirectionalChannelInfo_1set_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15068 LDKDirectionalChannelInfo this_ptr_conv;
15069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15070 this_ptr_conv.is_owned = false;
15071 LDKRoutingFees val_conv;
15072 val_conv.inner = (void*)(val & (~1));
15073 val_conv.is_owned = (val & 1) || (val == 0);
15074 if (val_conv.inner != NULL)
15075 val_conv = RoutingFees_clone(&val_conv);
15076 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
15079 uint32_t DirectionalChannelInfo_1get_1last_1update_1message(void* ctx_TODO, uint32_t this_ptr) {
15080 LDKDirectionalChannelInfo this_ptr_conv;
15081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15082 this_ptr_conv.is_owned = false;
15083 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
15084 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15085 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15086 long ret_ref = (long)ret_var.inner;
15087 if (ret_var.is_owned) {
15093 void DirectionalChannelInfo_1set_1last_1update_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15094 LDKDirectionalChannelInfo this_ptr_conv;
15095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15096 this_ptr_conv.is_owned = false;
15097 LDKChannelUpdate val_conv;
15098 val_conv.inner = (void*)(val & (~1));
15099 val_conv.is_owned = (val & 1) || (val == 0);
15100 if (val_conv.inner != NULL)
15101 val_conv = ChannelUpdate_clone(&val_conv);
15102 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
15105 int8_tArray DirectionalChannelInfo_1write(void* ctx_TODO, uint32_t obj) {
15106 LDKDirectionalChannelInfo obj_conv;
15107 obj_conv.inner = (void*)(obj & (~1));
15108 obj_conv.is_owned = false;
15109 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
15110 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
15111 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
15112 CVec_u8Z_free(arg_var);
15116 uint32_t DirectionalChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
15117 LDKu8slice ser_ref;
15118 ser_ref.datalen = *ser.len;
15119 ser_ref.data = (int8_t*)(ser.len + 1);
15120 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
15121 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15122 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15123 long ret_ref = (long)ret_var.inner;
15124 if (ret_var.is_owned) {
15130 void ChannelInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
15131 LDKChannelInfo this_ptr_conv;
15132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15134 ChannelInfo_free(this_ptr_conv);
15137 uint32_t ChannelInfo_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
15138 LDKChannelInfo this_ptr_conv;
15139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15140 this_ptr_conv.is_owned = false;
15141 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
15142 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15143 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15144 long ret_ref = (long)ret_var.inner;
15145 if (ret_var.is_owned) {
15151 void ChannelInfo_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15152 LDKChannelInfo this_ptr_conv;
15153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15154 this_ptr_conv.is_owned = false;
15155 LDKChannelFeatures val_conv;
15156 val_conv.inner = (void*)(val & (~1));
15157 val_conv.is_owned = (val & 1) || (val == 0);
15158 // Warning: we may need a move here but can't clone!
15159 ChannelInfo_set_features(&this_ptr_conv, val_conv);
15162 int8_tArray ChannelInfo_1get_1node_1one(void* ctx_TODO, uint32_t this_ptr) {
15163 LDKChannelInfo this_ptr_conv;
15164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15165 this_ptr_conv.is_owned = false;
15166 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
15167 memcpy(arg_arr.len + 1, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
15171 void ChannelInfo_1set_1node_1one(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15172 LDKChannelInfo this_ptr_conv;
15173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15174 this_ptr_conv.is_owned = false;
15175 LDKPublicKey val_ref;
15176 CHECK(*val.len == 33);
15177 memcpy(val_ref.compressed_form, val.len + 1, 33);
15178 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
15181 uint32_t ChannelInfo_1get_1one_1to_1two(void* ctx_TODO, uint32_t this_ptr) {
15182 LDKChannelInfo this_ptr_conv;
15183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15184 this_ptr_conv.is_owned = false;
15185 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
15186 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15187 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15188 long ret_ref = (long)ret_var.inner;
15189 if (ret_var.is_owned) {
15195 void ChannelInfo_1set_1one_1to_1two(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15196 LDKChannelInfo this_ptr_conv;
15197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15198 this_ptr_conv.is_owned = false;
15199 LDKDirectionalChannelInfo val_conv;
15200 val_conv.inner = (void*)(val & (~1));
15201 val_conv.is_owned = (val & 1) || (val == 0);
15202 // Warning: we may need a move here but can't clone!
15203 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
15206 int8_tArray ChannelInfo_1get_1node_1two(void* ctx_TODO, uint32_t this_ptr) {
15207 LDKChannelInfo this_ptr_conv;
15208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15209 this_ptr_conv.is_owned = false;
15210 int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
15211 memcpy(arg_arr.len + 1, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
15215 void ChannelInfo_1set_1node_1two(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15216 LDKChannelInfo this_ptr_conv;
15217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15218 this_ptr_conv.is_owned = false;
15219 LDKPublicKey val_ref;
15220 CHECK(*val.len == 33);
15221 memcpy(val_ref.compressed_form, val.len + 1, 33);
15222 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
15225 uint32_t ChannelInfo_1get_1two_1to_1one(void* ctx_TODO, uint32_t this_ptr) {
15226 LDKChannelInfo this_ptr_conv;
15227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15228 this_ptr_conv.is_owned = false;
15229 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
15230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15232 long ret_ref = (long)ret_var.inner;
15233 if (ret_var.is_owned) {
15239 void ChannelInfo_1set_1two_1to_1one(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15240 LDKChannelInfo this_ptr_conv;
15241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15242 this_ptr_conv.is_owned = false;
15243 LDKDirectionalChannelInfo val_conv;
15244 val_conv.inner = (void*)(val & (~1));
15245 val_conv.is_owned = (val & 1) || (val == 0);
15246 // Warning: we may need a move here but can't clone!
15247 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
15250 uint32_t ChannelInfo_1get_1announcement_1message(void* ctx_TODO, uint32_t this_ptr) {
15251 LDKChannelInfo this_ptr_conv;
15252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15253 this_ptr_conv.is_owned = false;
15254 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
15255 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15256 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15257 long ret_ref = (long)ret_var.inner;
15258 if (ret_var.is_owned) {
15264 void ChannelInfo_1set_1announcement_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15265 LDKChannelInfo this_ptr_conv;
15266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15267 this_ptr_conv.is_owned = false;
15268 LDKChannelAnnouncement val_conv;
15269 val_conv.inner = (void*)(val & (~1));
15270 val_conv.is_owned = (val & 1) || (val == 0);
15271 if (val_conv.inner != NULL)
15272 val_conv = ChannelAnnouncement_clone(&val_conv);
15273 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
15276 int8_tArray ChannelInfo_1write(void* ctx_TODO, uint32_t obj) {
15277 LDKChannelInfo obj_conv;
15278 obj_conv.inner = (void*)(obj & (~1));
15279 obj_conv.is_owned = false;
15280 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
15281 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
15282 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
15283 CVec_u8Z_free(arg_var);
15287 uint32_t ChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
15288 LDKu8slice ser_ref;
15289 ser_ref.datalen = *ser.len;
15290 ser_ref.data = (int8_t*)(ser.len + 1);
15291 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
15292 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15293 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15294 long ret_ref = (long)ret_var.inner;
15295 if (ret_var.is_owned) {
15301 void RoutingFees_1free(void* ctx_TODO, uint32_t this_ptr) {
15302 LDKRoutingFees this_ptr_conv;
15303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15305 RoutingFees_free(this_ptr_conv);
15308 uint32_t RoutingFees_1clone(void* ctx_TODO, uint32_t orig) {
15309 LDKRoutingFees orig_conv;
15310 orig_conv.inner = (void*)(orig & (~1));
15311 orig_conv.is_owned = false;
15312 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
15313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15315 long ret_ref = (long)ret_var.inner;
15316 if (ret_var.is_owned) {
15322 int32_t RoutingFees_1get_1base_1msat(void* ctx_TODO, uint32_t this_ptr) {
15323 LDKRoutingFees this_ptr_conv;
15324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15325 this_ptr_conv.is_owned = false;
15326 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
15330 void RoutingFees_1set_1base_1msat(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15331 LDKRoutingFees this_ptr_conv;
15332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15333 this_ptr_conv.is_owned = false;
15334 RoutingFees_set_base_msat(&this_ptr_conv, val);
15337 int32_t RoutingFees_1get_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr) {
15338 LDKRoutingFees this_ptr_conv;
15339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15340 this_ptr_conv.is_owned = false;
15341 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
15345 void RoutingFees_1set_1proportional_1millionths(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15346 LDKRoutingFees this_ptr_conv;
15347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15348 this_ptr_conv.is_owned = false;
15349 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
15352 uint32_t RoutingFees_1new(void* ctx_TODO, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
15353 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
15354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15356 long ret_ref = (long)ret_var.inner;
15357 if (ret_var.is_owned) {
15363 uint32_t RoutingFees_1read(void* ctx_TODO, int8_tArray ser) {
15364 LDKu8slice ser_ref;
15365 ser_ref.datalen = *ser.len;
15366 ser_ref.data = (int8_t*)(ser.len + 1);
15367 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15368 *ret_conv = RoutingFees_read(ser_ref);
15369 return (long)ret_conv;
15372 int8_tArray RoutingFees_1write(void* ctx_TODO, uint32_t obj) {
15373 LDKRoutingFees obj_conv;
15374 obj_conv.inner = (void*)(obj & (~1));
15375 obj_conv.is_owned = false;
15376 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
15377 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
15378 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
15379 CVec_u8Z_free(arg_var);
15383 void NodeAnnouncementInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
15384 LDKNodeAnnouncementInfo this_ptr_conv;
15385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15387 NodeAnnouncementInfo_free(this_ptr_conv);
15390 uint32_t NodeAnnouncementInfo_1get_1features(void* ctx_TODO, uint32_t this_ptr) {
15391 LDKNodeAnnouncementInfo this_ptr_conv;
15392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15393 this_ptr_conv.is_owned = false;
15394 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
15395 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15396 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15397 long ret_ref = (long)ret_var.inner;
15398 if (ret_var.is_owned) {
15404 void NodeAnnouncementInfo_1set_1features(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15405 LDKNodeAnnouncementInfo this_ptr_conv;
15406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15407 this_ptr_conv.is_owned = false;
15408 LDKNodeFeatures val_conv;
15409 val_conv.inner = (void*)(val & (~1));
15410 val_conv.is_owned = (val & 1) || (val == 0);
15411 // Warning: we may need a move here but can't clone!
15412 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
15415 int32_t NodeAnnouncementInfo_1get_1last_1update(void* ctx_TODO, uint32_t this_ptr) {
15416 LDKNodeAnnouncementInfo this_ptr_conv;
15417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15418 this_ptr_conv.is_owned = false;
15419 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
15423 void NodeAnnouncementInfo_1set_1last_1update(void* ctx_TODO, uint32_t this_ptr, int32_t val) {
15424 LDKNodeAnnouncementInfo this_ptr_conv;
15425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15426 this_ptr_conv.is_owned = false;
15427 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
15430 int8_tArray NodeAnnouncementInfo_1get_1rgb(void* ctx_TODO, uint32_t this_ptr) {
15431 LDKNodeAnnouncementInfo this_ptr_conv;
15432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15433 this_ptr_conv.is_owned = false;
15434 int8_tArray ret_arr = { .len = MALLOC(3 + sizeof(uint32_t), "Native int8_tArray Bytes") };
15435 memcpy(ret_arr.len + 1, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
15439 void NodeAnnouncementInfo_1set_1rgb(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15440 LDKNodeAnnouncementInfo this_ptr_conv;
15441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15442 this_ptr_conv.is_owned = false;
15443 LDKThreeBytes val_ref;
15444 CHECK(*val.len == 3);
15445 memcpy(val_ref.data, val.len + 1, 3);
15446 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
15449 int8_tArray NodeAnnouncementInfo_1get_1alias(void* ctx_TODO, uint32_t this_ptr) {
15450 LDKNodeAnnouncementInfo this_ptr_conv;
15451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15452 this_ptr_conv.is_owned = false;
15453 int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
15454 memcpy(ret_arr.len + 1, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
15458 void NodeAnnouncementInfo_1set_1alias(void* ctx_TODO, uint32_t this_ptr, int8_tArray val) {
15459 LDKNodeAnnouncementInfo this_ptr_conv;
15460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15461 this_ptr_conv.is_owned = false;
15462 LDKThirtyTwoBytes val_ref;
15463 CHECK(*val.len == 32);
15464 memcpy(val_ref.data, val.len + 1, 32);
15465 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
15468 void NodeAnnouncementInfo_1set_1addresses(void* ctx_TODO, uint32_t this_ptr, uint32_tArray val) {
15469 LDKNodeAnnouncementInfo this_ptr_conv;
15470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15471 this_ptr_conv.is_owned = false;
15472 LDKCVec_NetAddressZ val_constr;
15473 val_constr.datalen = *val.len;
15474 if (val_constr.datalen > 0)
15475 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15477 val_constr.data = NULL;
15478 uint32_t* val_vals = (uint32_t*)(val.len + 1);
15479 for (size_t m = 0; m < val_constr.datalen; m++) {
15480 uint32_t arr_conv_12 = val_vals[m];
15481 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
15482 FREE((void*)arr_conv_12);
15483 val_constr.data[m] = arr_conv_12_conv;
15485 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
15488 uint32_t NodeAnnouncementInfo_1get_1announcement_1message(void* ctx_TODO, uint32_t this_ptr) {
15489 LDKNodeAnnouncementInfo this_ptr_conv;
15490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15491 this_ptr_conv.is_owned = false;
15492 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
15493 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15494 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15495 long ret_ref = (long)ret_var.inner;
15496 if (ret_var.is_owned) {
15502 void NodeAnnouncementInfo_1set_1announcement_1message(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15503 LDKNodeAnnouncementInfo this_ptr_conv;
15504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15505 this_ptr_conv.is_owned = false;
15506 LDKNodeAnnouncement val_conv;
15507 val_conv.inner = (void*)(val & (~1));
15508 val_conv.is_owned = (val & 1) || (val == 0);
15509 if (val_conv.inner != NULL)
15510 val_conv = NodeAnnouncement_clone(&val_conv);
15511 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
15514 uint32_t NodeAnnouncementInfo_1new(void* ctx_TODO, uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) {
15515 LDKNodeFeatures features_arg_conv;
15516 features_arg_conv.inner = (void*)(features_arg & (~1));
15517 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
15518 // Warning: we may need a move here but can't clone!
15519 LDKThreeBytes rgb_arg_ref;
15520 CHECK(*rgb_arg.len == 3);
15521 memcpy(rgb_arg_ref.data, rgb_arg.len + 1, 3);
15522 LDKThirtyTwoBytes alias_arg_ref;
15523 CHECK(*alias_arg.len == 32);
15524 memcpy(alias_arg_ref.data, alias_arg.len + 1, 32);
15525 LDKCVec_NetAddressZ addresses_arg_constr;
15526 addresses_arg_constr.datalen = *addresses_arg.len;
15527 if (addresses_arg_constr.datalen > 0)
15528 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15530 addresses_arg_constr.data = NULL;
15531 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg.len + 1);
15532 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
15533 uint32_t arr_conv_12 = addresses_arg_vals[m];
15534 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
15535 FREE((void*)arr_conv_12);
15536 addresses_arg_constr.data[m] = arr_conv_12_conv;
15538 LDKNodeAnnouncement announcement_message_arg_conv;
15539 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
15540 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
15541 if (announcement_message_arg_conv.inner != NULL)
15542 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
15543 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
15544 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15545 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15546 long ret_ref = (long)ret_var.inner;
15547 if (ret_var.is_owned) {
15553 int8_tArray NodeAnnouncementInfo_1write(void* ctx_TODO, uint32_t obj) {
15554 LDKNodeAnnouncementInfo obj_conv;
15555 obj_conv.inner = (void*)(obj & (~1));
15556 obj_conv.is_owned = false;
15557 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
15558 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
15559 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
15560 CVec_u8Z_free(arg_var);
15564 uint32_t NodeAnnouncementInfo_1read(void* ctx_TODO, int8_tArray ser) {
15565 LDKu8slice ser_ref;
15566 ser_ref.datalen = *ser.len;
15567 ser_ref.data = (int8_t*)(ser.len + 1);
15568 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15569 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
15570 return (long)ret_conv;
15573 void NodeInfo_1free(void* ctx_TODO, uint32_t this_ptr) {
15574 LDKNodeInfo this_ptr_conv;
15575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15577 NodeInfo_free(this_ptr_conv);
15580 void NodeInfo_1set_1channels(void* ctx_TODO, uint32_t this_ptr, int64_tArray val) {
15581 LDKNodeInfo this_ptr_conv;
15582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15583 this_ptr_conv.is_owned = false;
15584 LDKCVec_u64Z val_constr;
15585 val_constr.datalen = *val.len;
15586 if (val_constr.datalen > 0)
15587 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15589 val_constr.data = NULL;
15590 int64_t* val_vals = (int64_t*)(val.len + 1);
15591 for (size_t i = 0; i < val_constr.datalen; i++) {
15592 int64_t arr_conv_8 = val_vals[i];
15593 val_constr.data[i] = arr_conv_8;
15595 NodeInfo_set_channels(&this_ptr_conv, val_constr);
15598 uint32_t NodeInfo_1get_1lowest_1inbound_1channel_1fees(void* ctx_TODO, uint32_t this_ptr) {
15599 LDKNodeInfo this_ptr_conv;
15600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15601 this_ptr_conv.is_owned = false;
15602 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
15603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15605 long ret_ref = (long)ret_var.inner;
15606 if (ret_var.is_owned) {
15612 void NodeInfo_1set_1lowest_1inbound_1channel_1fees(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15613 LDKNodeInfo this_ptr_conv;
15614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15615 this_ptr_conv.is_owned = false;
15616 LDKRoutingFees val_conv;
15617 val_conv.inner = (void*)(val & (~1));
15618 val_conv.is_owned = (val & 1) || (val == 0);
15619 if (val_conv.inner != NULL)
15620 val_conv = RoutingFees_clone(&val_conv);
15621 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
15624 uint32_t NodeInfo_1get_1announcement_1info(void* ctx_TODO, uint32_t this_ptr) {
15625 LDKNodeInfo this_ptr_conv;
15626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15627 this_ptr_conv.is_owned = false;
15628 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
15629 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15630 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15631 long ret_ref = (long)ret_var.inner;
15632 if (ret_var.is_owned) {
15638 void NodeInfo_1set_1announcement_1info(void* ctx_TODO, uint32_t this_ptr, uint32_t val) {
15639 LDKNodeInfo this_ptr_conv;
15640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15641 this_ptr_conv.is_owned = false;
15642 LDKNodeAnnouncementInfo val_conv;
15643 val_conv.inner = (void*)(val & (~1));
15644 val_conv.is_owned = (val & 1) || (val == 0);
15645 // Warning: we may need a move here but can't clone!
15646 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
15649 uint32_t NodeInfo_1new(void* ctx_TODO, int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
15650 LDKCVec_u64Z channels_arg_constr;
15651 channels_arg_constr.datalen = *channels_arg.len;
15652 if (channels_arg_constr.datalen > 0)
15653 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
15655 channels_arg_constr.data = NULL;
15656 int64_t* channels_arg_vals = (int64_t*)(channels_arg.len + 1);
15657 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
15658 int64_t arr_conv_8 = channels_arg_vals[i];
15659 channels_arg_constr.data[i] = arr_conv_8;
15661 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
15662 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
15663 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
15664 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
15665 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
15666 LDKNodeAnnouncementInfo announcement_info_arg_conv;
15667 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
15668 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
15669 // Warning: we may need a move here but can't clone!
15670 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
15671 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15672 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15673 long ret_ref = (long)ret_var.inner;
15674 if (ret_var.is_owned) {
15680 int8_tArray NodeInfo_1write(void* ctx_TODO, uint32_t obj) {
15681 LDKNodeInfo obj_conv;
15682 obj_conv.inner = (void*)(obj & (~1));
15683 obj_conv.is_owned = false;
15684 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
15685 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
15686 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
15687 CVec_u8Z_free(arg_var);
15691 uint32_t NodeInfo_1read(void* ctx_TODO, int8_tArray ser) {
15692 LDKu8slice ser_ref;
15693 ser_ref.datalen = *ser.len;
15694 ser_ref.data = (int8_t*)(ser.len + 1);
15695 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15696 *ret_conv = NodeInfo_read(ser_ref);
15697 return (long)ret_conv;
15700 int8_tArray NetworkGraph_1write(void* ctx_TODO, uint32_t obj) {
15701 LDKNetworkGraph obj_conv;
15702 obj_conv.inner = (void*)(obj & (~1));
15703 obj_conv.is_owned = false;
15704 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
15705 int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
15706 memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
15707 CVec_u8Z_free(arg_var);
15711 uint32_t NetworkGraph_1read(void* ctx_TODO, int8_tArray ser) {
15712 LDKu8slice ser_ref;
15713 ser_ref.datalen = *ser.len;
15714 ser_ref.data = (int8_t*)(ser.len + 1);
15715 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15716 *ret_conv = NetworkGraph_read(ser_ref);
15717 return (long)ret_conv;
15720 uint32_t NetworkGraph_1new(void* ctx_TODO, int8_tArray genesis_hash) {
15721 LDKThirtyTwoBytes genesis_hash_ref;
15722 CHECK(*genesis_hash.len == 32);
15723 memcpy(genesis_hash_ref.data, genesis_hash.len + 1, 32);
15724 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
15725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15727 long ret_ref = (long)ret_var.inner;
15728 if (ret_var.is_owned) {
15734 uint32_t NetworkGraph_1update_1node_1from_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15735 LDKNetworkGraph this_arg_conv;
15736 this_arg_conv.inner = (void*)(this_arg & (~1));
15737 this_arg_conv.is_owned = false;
15738 LDKNodeAnnouncement msg_conv;
15739 msg_conv.inner = (void*)(msg & (~1));
15740 msg_conv.is_owned = false;
15741 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15742 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
15743 return (long)ret_conv;
15746 uint32_t NetworkGraph_1update_1node_1from_1unsigned_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15747 LDKNetworkGraph this_arg_conv;
15748 this_arg_conv.inner = (void*)(this_arg & (~1));
15749 this_arg_conv.is_owned = false;
15750 LDKUnsignedNodeAnnouncement msg_conv;
15751 msg_conv.inner = (void*)(msg & (~1));
15752 msg_conv.is_owned = false;
15753 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15754 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
15755 return (long)ret_conv;
15758 uint32_t NetworkGraph_1update_1channel_1from_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
15759 LDKNetworkGraph this_arg_conv;
15760 this_arg_conv.inner = (void*)(this_arg & (~1));
15761 this_arg_conv.is_owned = false;
15762 LDKChannelAnnouncement msg_conv;
15763 msg_conv.inner = (void*)(msg & (~1));
15764 msg_conv.is_owned = false;
15765 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
15766 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15767 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
15768 return (long)ret_conv;
15771 uint32_t NetworkGraph_1update_1channel_1from_1unsigned_1announcement(void* ctx_TODO, uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
15772 LDKNetworkGraph this_arg_conv;
15773 this_arg_conv.inner = (void*)(this_arg & (~1));
15774 this_arg_conv.is_owned = false;
15775 LDKUnsignedChannelAnnouncement msg_conv;
15776 msg_conv.inner = (void*)(msg & (~1));
15777 msg_conv.is_owned = false;
15778 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
15779 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15780 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
15781 return (long)ret_conv;
15784 void NetworkGraph_1close_1channel_1from_1update(void* ctx_TODO, uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
15785 LDKNetworkGraph this_arg_conv;
15786 this_arg_conv.inner = (void*)(this_arg & (~1));
15787 this_arg_conv.is_owned = false;
15788 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
15791 uint32_t NetworkGraph_1update_1channel(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15792 LDKNetworkGraph this_arg_conv;
15793 this_arg_conv.inner = (void*)(this_arg & (~1));
15794 this_arg_conv.is_owned = false;
15795 LDKChannelUpdate msg_conv;
15796 msg_conv.inner = (void*)(msg & (~1));
15797 msg_conv.is_owned = false;
15798 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15799 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
15800 return (long)ret_conv;
15803 uint32_t NetworkGraph_1update_1channel_1unsigned(void* ctx_TODO, uint32_t this_arg, uint32_t msg) {
15804 LDKNetworkGraph this_arg_conv;
15805 this_arg_conv.inner = (void*)(this_arg & (~1));
15806 this_arg_conv.is_owned = false;
15807 LDKUnsignedChannelUpdate msg_conv;
15808 msg_conv.inner = (void*)(msg & (~1));
15809 msg_conv.is_owned = false;
15810 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15811 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
15812 return (long)ret_conv;