#include <rust_types.h>
+#include "js-wasm.h"
#include <stdatomic.h>
#include <lightning.h>
_Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
-typedef struct int64_tArray {uint32_t len;int64_t *ptr;} int64_tArray;
-typedef struct uint32_tArray {uint32_t len;int32_t *ptr;} uint32_tArray;
-typedef struct ptrArray {uint32_t len;int32_t *ptr;} ptrArray;
-typedef struct int8_tArray {uint32_t len;int8_t *ptr;} int8_tArray;
+typedef struct int64_tArray { uint32_t *len; /* len + 1 is data */ } int64_tArray;
+typedef struct uint32_tArray { uint32_t *len; /* len + 1 is data */ } uint32_tArray;
+typedef struct ptrArray { uint32_t *len; /* len + 1 is data */ } ptrArray;
+typedef struct int8_tArray { uint32_t *len; /* len + 1 is data */ } int8_tArray;
typedef struct jstring {} jstring;
jstring conv_owned_string(const char* _src) { jstring a; return a; }
}
uint32_t LDKCVec_1u8Z_1new(void* ctx_TODO, int8_tArray elems) {
LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
- int8_t *java_elems = (int8_t*)elems.ptr;
+ int8_t *java_elems = (int8_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
ret->data[i] = java_elems[i];
}
CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
long outpoint_ref = (long)outpoint_var.inner & ~1;
- int8_tArray per_commitment_point_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(per_commitment_point_arr.ptr, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form, 33);
+ int8_tArray per_commitment_point_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(per_commitment_point_arr.len + 1, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form, 33);
long output_ref = (long)&obj->dynamic_output_p2wsh.output;
long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
- int8_tArray revocation_pubkey_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(revocation_pubkey_arr.ptr, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form, 33);
+ int8_tArray revocation_pubkey_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(revocation_pubkey_arr.len + 1, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form, 33);
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;
}
case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
}
uint32_t LDKCVec_1SpendableOutputDescriptorZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
}
case LDKHTLCFailChannelUpdate_NodeFailure: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->node_failure.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->node_failure.node_id.compressed_form, 33);
return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
}
default: abort();
LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
switch(obj->tag) {
case LDKMessageSendEvent_SendAcceptChannel: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_accept_channel.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_accept_channel.node_id.compressed_form, 33);
LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendOpenChannel: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_open_channel.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_open_channel.node_id.compressed_form, 33);
LDKOpenChannel msg_var = obj->send_open_channel.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendFundingCreated: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_funding_created.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_funding_created.node_id.compressed_form, 33);
LDKFundingCreated msg_var = obj->send_funding_created.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendFundingSigned: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_funding_signed.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_funding_signed.node_id.compressed_form, 33);
LDKFundingSigned msg_var = obj->send_funding_signed.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendFundingLocked: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_funding_locked.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_funding_locked.node_id.compressed_form, 33);
LDKFundingLocked msg_var = obj->send_funding_locked.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendAnnouncementSignatures: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_announcement_signatures.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_announcement_signatures.node_id.compressed_form, 33);
LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_UpdateHTLCs: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->update_htl_cs.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->update_htl_cs.node_id.compressed_form, 33);
LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
}
case LDKMessageSendEvent_SendRevokeAndACK: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_revoke_and_ack.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_revoke_and_ack.node_id.compressed_form, 33);
LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendClosingSigned: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_closing_signed.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_closing_signed.node_id.compressed_form, 33);
LDKClosingSigned msg_var = obj->send_closing_signed.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendShutdown: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_shutdown.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_shutdown.node_id.compressed_form, 33);
LDKShutdown msg_var = obj->send_shutdown.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendChannelReestablish: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_channel_reestablish.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_channel_reestablish.node_id.compressed_form, 33);
LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
}
case LDKMessageSendEvent_HandleError: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->handle_error.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->handle_error.node_id.compressed_form, 33);
long action_ref = (long)&obj->handle_error.action;
return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
}
return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
}
case LDKMessageSendEvent_SendChannelRangeQuery: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_channel_range_query.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_channel_range_query.node_id.compressed_form, 33);
LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
}
case LDKMessageSendEvent_SendShortIdsQuery: {
- int8_tArray node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(node_id_arr.ptr, obj->send_short_ids_query.node_id.compressed_form, 33);
+ int8_tArray node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(node_id_arr.len + 1, obj->send_short_ids_query.node_id.compressed_form, 33);
LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
}
uint32_t LDKCVec_1MessageSendEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
LDKEvent *obj = (LDKEvent*)ptr;
switch(obj->tag) {
case LDKEvent_FundingGenerationReady: {
- int8_tArray temporary_channel_id_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(temporary_channel_id_arr.ptr, obj->funding_generation_ready.temporary_channel_id.data, 32);
+ int8_tArray temporary_channel_id_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(temporary_channel_id_arr.len + 1, obj->funding_generation_ready.temporary_channel_id.data, 32);
LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
- int8_tArray output_script_arr = { .len = output_script_var.datalen, .ptr = MALLOC(output_script_var.datalen, "Native int8_tArray Bytes") };
- memcpy(output_script_arr.ptr, output_script_var.data, output_script_var.datalen);
+ int8_tArray output_script_arr = { .len = MALLOC(output_script_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(output_script_arr.len + 1, output_script_var.data, output_script_var.datalen);
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;
}
case LDKEvent_FundingBroadcastSafe: {
return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
}
case LDKEvent_PaymentReceived: {
- int8_tArray payment_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(payment_hash_arr.ptr, obj->payment_received.payment_hash.data, 32);
- int8_tArray payment_secret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(payment_secret_arr.ptr, obj->payment_received.payment_secret.data, 32);
+ int8_tArray payment_hash_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(payment_hash_arr.len + 1, obj->payment_received.payment_hash.data, 32);
+ int8_tArray payment_secret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(payment_secret_arr.len + 1, obj->payment_received.payment_secret.data, 32);
return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
}
case LDKEvent_PaymentSent: {
- int8_tArray payment_preimage_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(payment_preimage_arr.ptr, obj->payment_sent.payment_preimage.data, 32);
+ int8_tArray payment_preimage_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(payment_preimage_arr.len + 1, obj->payment_sent.payment_preimage.data, 32);
return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
}
case LDKEvent_PaymentFailed: {
- int8_tArray payment_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(payment_hash_arr.ptr, obj->payment_failed.payment_hash.data, 32);
+ int8_tArray payment_hash_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(payment_hash_arr.len + 1, obj->payment_failed.payment_hash.data, 32);
return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
}
case LDKEvent_PendingHTLCsForwardable: {
}
case LDKEvent_SpendableOutputs: {
LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
- uint32_tArray outputs_arr = { .len = outputs_var.datalen, .ptr = MALLOC(outputs_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *outputs_arr_ptr = (uint32_t*)outputs_arr.ptr;
+ uint32_tArray outputs_arr = { .len = MALLOC(outputs_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr.len + 1);
for (size_t b = 0; b < outputs_var.datalen; b++) {
long arr_conv_27_ref = (long)&outputs_var.data[b];
outputs_arr_ptr[b] = arr_conv_27_ref;
}
uint32_t LDKCVec_1EventZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
ret->a = a;
LDKTransaction b_ref;
- b_ref.datalen = b.len;
+ b_ref.datalen = *b.len;
b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
- memcpy(b_ref.data, b.ptr, b_ref.datalen);
+ memcpy(b_ref.data, b.len + 1, b_ref.datalen);
b_ref.data_is_owned = false;
ret->b = b_ref;
return (long)ret;
int8_tArray LDKC2Tuple_1usizeTransactionZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
LDKTransaction b_var = tuple->b;
- int8_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen, "Native int8_tArray Bytes") };
- memcpy(b_arr.ptr, b_var.data, b_var.datalen);
+ int8_tArray b_arr = { .len = MALLOC(b_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(b_arr.len + 1, b_var.data, b_var.datalen);
return b_arr;
}
uint32_t LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_elem;
}
uint32_t LDKCVec_1MonitorEventZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKMonitorEvent arr_elem_conv;
a_conv = OutPoint_clone(&a_conv);
ret->a = a_conv;
LDKCVec_u8Z b_ref;
- b_ref.datalen = b.len;
+ b_ref.datalen = *b.len;
b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(b_ref.data, b.ptr, b_ref.datalen);
+ memcpy(b_ref.data, b.len + 1, b_ref.datalen);
ret->b = b_ref;
return (long)ret;
}
int8_tArray LDKC2Tuple_1OutPointScriptZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
LDKCVec_u8Z b_var = tuple->b;
- int8_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen, "Native int8_tArray Bytes") };
- memcpy(b_arr.ptr, b_var.data, b_var.datalen);
+ int8_tArray b_arr = { .len = MALLOC(b_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(b_arr.len + 1, b_var.data, b_var.datalen);
return b_arr;
}
uint32_t LDKC2Tuple_1u32TxOutZ_1new(void* ctx_TODO, int32_t a, uint32_t b) {
}
uint32_t LDKCVec_1C2Tuple_1u32TxOutZZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)arr_elem;
uint32_t LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
LDKThirtyTwoBytes a_ref;
- CHECK(a.len == 32);
- memcpy(a_ref.data, a.ptr, 32);
+ CHECK(*a.len == 32);
+ memcpy(a_ref.data, a.len + 1, 32);
ret->a = a_ref;
LDKCVec_C2Tuple_u32TxOutZZ b_constr;
- b_constr.datalen = b.len;
+ b_constr.datalen = *b.len;
if (b_constr.datalen > 0)
b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
else
b_constr.data = NULL;
- uint32_t* b_vals = (uint32_t*) b.ptr;
+ uint32_t* b_vals = (uint32_t*)(b.len + 1);
for (size_t z = 0; z < b_constr.datalen; z++) {
uint32_t arr_conv_25 = b_vals[z];
LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
}
int8_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
- int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(a_arr.ptr, tuple->a.data, 32);
+ int8_tArray a_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(a_arr.len + 1, tuple->a.data, 32);
return a_arr;
}
uint32_tArray LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
- uint32_tArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *b_arr_ptr = (uint32_t*)b_arr.ptr;
+ uint32_tArray b_arr = { .len = MALLOC(b_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *b_arr_ptr = (uint32_t*)(b_arr.len + 1);
for (size_t z = 0; z < b_var.datalen; z++) {
long arr_conv_25_ref = (long)&b_var.data[z];
b_arr_ptr[z] = arr_conv_25_ref;
}
uint32_t LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_elem;
uint32_t LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, ptrArray b) {
LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
LDKSignature a_ref;
- CHECK(a.len == 64);
- memcpy(a_ref.compact_form, a.ptr, 64);
+ CHECK(*a.len == 64);
+ memcpy(a_ref.compact_form, a.len + 1, 64);
ret->a = a_ref;
LDKCVec_SignatureZ b_constr;
- b_constr.datalen = b.len;
+ b_constr.datalen = *b.len;
if (b_constr.datalen > 0)
b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
b_constr.data = NULL;
- int8_tArray* b_vals = (int8_tArray*) b.ptr;
+ int8_tArray* b_vals = (int8_tArray*)(b.len + 1);
for (size_t m = 0; m < b_constr.datalen; m++) {
int8_tArray arr_conv_12 = b_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
b_constr.data[m] = arr_conv_12_ref;
}
ret->b = b_constr;
}
int8_tArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
- int8_tArray a_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(a_arr.ptr, tuple->a.compact_form, 64);
+ int8_tArray a_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(a_arr.len + 1, tuple->a.compact_form, 64);
return a_arr;
}
ptrArray LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
LDKCVec_SignatureZ b_var = tuple->b;
- ptrArray b_arr = { .len = b_var.datalen, .ptr = MALLOC(b_var.datalen * sizeof(int32_t), "Native Object Bytes") };
- int8_tArray *b_arr_ptr = (int8_tArray*)b_arr.ptr;
+ ptrArray b_arr = { .len = MALLOC(b_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
+ int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr.len + 1);
for (size_t m = 0; m < b_var.datalen; m++) {
- int8_tArray arr_conv_12_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arr_conv_12_arr.ptr, b_var.data[m].compact_form, 64);
+ int8_tArray arr_conv_12_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arr_conv_12_arr.len + 1, b_var.data[m].compact_form, 64);
b_arr_ptr[m] = arr_conv_12_arr;
}
return b_arr;
int8_tArray LDKCResult_1SignatureNoneZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
CHECK(val->result_ok);
- int8_tArray res_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(res_arr.ptr, (*val->contents.result).compact_form, 64);
+ int8_tArray res_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(res_arr.len + 1, (*val->contents.result).compact_form, 64);
return res_arr;
}
void LDKCResult_1SignatureNoneZ_1get_1err (void* ctx_TODO, uint32_t arg) {
LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
CHECK(val->result_ok);
LDKCVec_SignatureZ res_var = (*val->contents.result);
- ptrArray res_arr = { .len = res_var.datalen, .ptr = MALLOC(res_var.datalen * sizeof(int32_t), "Native Object Bytes") };
- int8_tArray *res_arr_ptr = (int8_tArray*)res_arr.ptr;
+ ptrArray res_arr = { .len = MALLOC(res_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
+ int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr.len + 1);
for (size_t m = 0; m < res_var.datalen; m++) {
- int8_tArray arr_conv_12_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arr_conv_12_arr.ptr, res_var.data[m].compact_form, 64);
+ int8_tArray arr_conv_12_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arr_conv_12_arr.len + 1, res_var.data[m].compact_form, 64);
res_arr_ptr[m] = arr_conv_12_arr;
}
return res_arr;
//TODO: jobject obj = get object we can call against on j_calls->o
int8_tArray arg; // TODO: Call get_per_commitment_point on j_calls with instance obj, returning an object, idx);
LDKPublicKey arg_ref;
- CHECK(arg.len == 33);
- memcpy(arg_ref.compressed_form, arg.ptr, 33);
+ CHECK(*arg.len == 33);
+ memcpy(arg_ref.compressed_form, arg.len + 1, 33);
return arg_ref;
}
LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
//TODO: jobject obj = get object we can call against on j_calls->o
int8_tArray arg; // TODO: Call release_commitment_secret on j_calls with instance obj, returning an object, idx);
LDKThirtyTwoBytes arg_ref;
- CHECK(arg.len == 32);
- memcpy(arg_ref.data, arg.ptr, 32);
+ CHECK(*arg.len == 32);
+ memcpy(arg_ref.data, arg.len + 1, 32);
return arg_ref;
}
LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
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) {
LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
LDKTransaction justice_tx_var = justice_tx;
- int8_tArray justice_tx_arr = { .len = justice_tx_var.datalen, .ptr = MALLOC(justice_tx_var.datalen, "Native int8_tArray Bytes") };
- memcpy(justice_tx_arr.ptr, justice_tx_var.data, justice_tx_var.datalen);
+ int8_tArray justice_tx_arr = { .len = MALLOC(justice_tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(justice_tx_arr.len + 1, justice_tx_var.data, justice_tx_var.datalen);
Transaction_free(justice_tx_var);
- int8_tArray per_commitment_key_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(per_commitment_key_arr.ptr, *per_commitment_key, 32);
+ int8_tArray per_commitment_key_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(per_commitment_key_arr.len + 1, *per_commitment_key, 32);
LDKHTLCOutputInCommitment htlc_var = *htlc;
if (htlc->inner != NULL)
htlc_var = HTLCOutputInCommitment_clone(htlc);
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) {
LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
LDKTransaction htlc_tx_var = htlc_tx;
- int8_tArray htlc_tx_arr = { .len = htlc_tx_var.datalen, .ptr = MALLOC(htlc_tx_var.datalen, "Native int8_tArray Bytes") };
- memcpy(htlc_tx_arr.ptr, htlc_tx_var.data, htlc_tx_var.datalen);
+ int8_tArray htlc_tx_arr = { .len = MALLOC(htlc_tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(htlc_tx_arr.len + 1, htlc_tx_var.data, htlc_tx_var.datalen);
Transaction_free(htlc_tx_var);
- int8_tArray per_commitment_point_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(per_commitment_point_arr.ptr, per_commitment_point.compressed_form, 33);
+ int8_tArray per_commitment_point_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(per_commitment_point_arr.len + 1, per_commitment_point.compressed_form, 33);
LDKHTLCOutputInCommitment htlc_var = *htlc;
if (htlc->inner != NULL)
htlc_var = HTLCOutputInCommitment_clone(htlc);
LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
LDKTransaction closing_tx_var = closing_tx;
- int8_tArray closing_tx_arr = { .len = closing_tx_var.datalen, .ptr = MALLOC(closing_tx_var.datalen, "Native int8_tArray Bytes") };
- memcpy(closing_tx_arr.ptr, closing_tx_var.data, closing_tx_var.datalen);
+ int8_tArray closing_tx_arr = { .len = MALLOC(closing_tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(closing_tx_arr.len + 1, closing_tx_var.data, closing_tx_var.datalen);
Transaction_free(closing_tx_var);
//TODO: jobject obj = get object we can call against on j_calls->o
LDKCResult_SignatureNoneZ* ret; // TODO: Call sign_closing_transaction on j_calls with instance obj, returning a pointer, closing_tx_arr);
//TODO: jobject obj = get object we can call against on j_calls->o
int8_tArray arg; // TODO: Call write on j_calls with instance obj, returning an object);
LDKCVec_u8Z arg_ref;
- arg_ref.datalen = arg.len;
+ arg_ref.datalen = *arg.len;
arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(arg_ref.data, arg.ptr, arg_ref.datalen);
+ memcpy(arg_ref.data, arg.len + 1, arg_ref.datalen);
return arg_ref;
}
static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
}
int8_tArray ChannelKeys_1get_1per_1commitment_1point(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
return arg_arr;
}
int8_tArray ChannelKeys_1release_1commitment_1secret(void* ctx_TODO, uint32_t this_arg, int64_t idx) {
LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
- int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
+ int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
return arg_arr;
}
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) {
LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
LDKTransaction justice_tx_ref;
- justice_tx_ref.datalen = justice_tx.len;
+ justice_tx_ref.datalen = *justice_tx.len;
justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
- memcpy(justice_tx_ref.data, justice_tx.ptr, justice_tx_ref.datalen);
+ memcpy(justice_tx_ref.data, justice_tx.len + 1, justice_tx_ref.datalen);
justice_tx_ref.data_is_owned = true;
unsigned char per_commitment_key_arr[32];
- CHECK(per_commitment_key.len == 32);
- memcpy(per_commitment_key_arr, per_commitment_key.ptr, 32);
+ CHECK(*per_commitment_key.len == 32);
+ memcpy(per_commitment_key_arr, per_commitment_key.len + 1, 32);
unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
LDKHTLCOutputInCommitment htlc_conv;
htlc_conv.inner = (void*)(htlc & (~1));
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) {
LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
LDKTransaction htlc_tx_ref;
- htlc_tx_ref.datalen = htlc_tx.len;
+ htlc_tx_ref.datalen = *htlc_tx.len;
htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
- memcpy(htlc_tx_ref.data, htlc_tx.ptr, htlc_tx_ref.datalen);
+ memcpy(htlc_tx_ref.data, htlc_tx.len + 1, htlc_tx_ref.datalen);
htlc_tx_ref.data_is_owned = true;
LDKPublicKey per_commitment_point_ref;
- CHECK(per_commitment_point.len == 33);
- memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
+ CHECK(*per_commitment_point.len == 33);
+ memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
LDKHTLCOutputInCommitment htlc_conv;
htlc_conv.inner = (void*)(htlc & (~1));
htlc_conv.is_owned = false;
uint32_t ChannelKeys_1sign_1closing_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray closing_tx) {
LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
LDKTransaction closing_tx_ref;
- closing_tx_ref.datalen = closing_tx.len;
+ closing_tx_ref.datalen = *closing_tx.len;
closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
- memcpy(closing_tx_ref.data, closing_tx.ptr, closing_tx_ref.datalen);
+ memcpy(closing_tx_ref.data, closing_tx.len + 1, closing_tx_ref.datalen);
closing_tx_ref.data_is_owned = true;
LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
*ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
int8_tArray ChannelKeys_1write(void* ctx_TODO, uint32_t this_arg) {
LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
LDKThirtyTwoBytes a_ref;
- CHECK(a.len == 32);
- memcpy(a_ref.data, a.ptr, 32);
+ CHECK(*a.len == 32);
+ memcpy(a_ref.data, a.len + 1, 32);
ret->a = a_ref;
LDKChannelMonitor b_conv;
b_conv.inner = (void*)(b & (~1));
}
int8_tArray LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
- int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(a_arr.ptr, tuple->a.data, 32);
+ int8_tArray a_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(a_arr.len + 1, tuple->a.data, 32);
return a_arr;
}
uint32_t LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
switch(obj->tag) {
case LDKAPIError_APIMisuseError: {
LDKCVec_u8Z err_var = obj->api_misuse_error.err;
- int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
- memcpy(err_arr.ptr, err_var.data, err_var.datalen);
+ int8_tArray err_arr = { .len = MALLOC(err_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(err_arr.len + 1, err_var.data, err_var.datalen);
return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
}
case LDKAPIError_FeeRateTooHigh: {
LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
- int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
- memcpy(err_arr.ptr, err_var.data, err_var.datalen);
+ int8_tArray err_arr = { .len = MALLOC(err_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(err_arr.len + 1, err_var.data, err_var.datalen);
return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
}
case LDKAPIError_RouteError: {
}
case LDKAPIError_ChannelUnavailable: {
LDKCVec_u8Z err_var = obj->channel_unavailable.err;
- int8_tArray err_arr = { .len = err_var.datalen, .ptr = MALLOC(err_var.datalen, "Native int8_tArray Bytes") };
- memcpy(err_arr.ptr, err_var.data, err_var.datalen);
+ int8_tArray err_arr = { .len = MALLOC(err_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(err_arr.len + 1, err_var.data, err_var.datalen);
return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
}
case LDKAPIError_MonitorUpdateFailed: {
}
uint32_t LDKCVec_1ChannelDetailsZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKChannelDetails arr_elem_conv;
LDKNetAddress *obj = (LDKNetAddress*)ptr;
switch(obj->tag) {
case LDKNetAddress_IPv4: {
- int8_tArray addr_arr = { .len = 4, .ptr = MALLOC(4, "Native int8_tArray Bytes") };
- memcpy(addr_arr.ptr, obj->i_pv4.addr.data, 4);
+ int8_tArray addr_arr = { .len = MALLOC(4 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(addr_arr.len + 1, obj->i_pv4.addr.data, 4);
return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
}
case LDKNetAddress_IPv6: {
- int8_tArray addr_arr = { .len = 16, .ptr = MALLOC(16, "Native int8_tArray Bytes") };
- memcpy(addr_arr.ptr, obj->i_pv6.addr.data, 16);
+ int8_tArray addr_arr = { .len = MALLOC(16 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(addr_arr.len + 1, obj->i_pv6.addr.data, 16);
return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
}
case LDKNetAddress_OnionV2: {
- int8_tArray addr_arr = { .len = 10, .ptr = MALLOC(10, "Native int8_tArray Bytes") };
- memcpy(addr_arr.ptr, obj->onion_v2.addr.data, 10);
+ int8_tArray addr_arr = { .len = MALLOC(10 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(addr_arr.len + 1, obj->onion_v2.addr.data, 10);
return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
}
case LDKNetAddress_OnionV3: {
- int8_tArray ed25519_pubkey_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ed25519_pubkey_arr.ptr, obj->onion_v3.ed25519_pubkey.data, 32);
+ int8_tArray ed25519_pubkey_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ed25519_pubkey_arr.len + 1, obj->onion_v3.ed25519_pubkey.data, 32);
return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
}
default: abort();
}
uint32_t LDKCVec_1NetAddressZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
}
uint32_t LDKCVec_1ChannelMonitorZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKChannelMonitor arr_elem_conv;
//TODO: jobject obj = get object we can call against on j_calls->o
uint32_tArray arg; // TODO: Call release_pending_monitor_events on j_calls with instance obj, returning an object);
LDKCVec_MonitorEventZ arg_constr;
- arg_constr.datalen = arg.len;
+ arg_constr.datalen = *arg.len;
if (arg_constr.datalen > 0)
arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
else
arg_constr.data = NULL;
- uint32_t* arg_vals = (uint32_t*) arg.ptr;
+ uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
for (size_t o = 0; o < arg_constr.datalen; o++) {
uint32_t arr_conv_14 = arg_vals[o];
LDKMonitorEvent arr_conv_14_conv;
uint32_tArray Watch_1release_1pending_1monitor_1events(void* ctx_TODO, uint32_t this_arg) {
LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t o = 0; o < ret_var.datalen; o++) {
LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
LDKTransaction tx_var = tx;
- int8_tArray tx_arr = { .len = tx_var.datalen, .ptr = MALLOC(tx_var.datalen, "Native int8_tArray Bytes") };
- memcpy(tx_arr.ptr, tx_var.data, tx_var.datalen);
+ int8_tArray tx_arr = { .len = MALLOC(tx_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(tx_arr.len + 1, tx_var.data, tx_var.datalen);
Transaction_free(tx_var);
//TODO: jobject obj = get object we can call against on j_calls->o
return; //TODO: Call broadcast_transaction on j_calls with instance obj, tx_arr);
void BroadcasterInterface_1broadcast_1transaction(void* ctx_TODO, uint32_t this_arg, int8_tArray tx) {
LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
LDKTransaction tx_ref;
- tx_ref.datalen = tx.len;
+ tx_ref.datalen = *tx.len;
tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
- memcpy(tx_ref.data, tx.ptr, tx_ref.datalen);
+ memcpy(tx_ref.data, tx.len + 1, tx_ref.datalen);
tx_ref.data_is_owned = true;
(this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
}
//TODO: jobject obj = get object we can call against on j_calls->o
int8_tArray arg; // TODO: Call get_node_secret on j_calls with instance obj, returning an object);
LDKSecretKey arg_ref;
- CHECK(arg.len == 32);
- memcpy(arg_ref.bytes, arg.ptr, 32);
+ CHECK(*arg.len == 32);
+ memcpy(arg_ref.bytes, arg.len + 1, 32);
return arg_ref;
}
LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
//TODO: jobject obj = get object we can call against on j_calls->o
int8_tArray arg; // TODO: Call get_destination_script on j_calls with instance obj, returning an object);
LDKCVec_u8Z arg_ref;
- arg_ref.datalen = arg.len;
+ arg_ref.datalen = *arg.len;
arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(arg_ref.data, arg.ptr, arg_ref.datalen);
+ memcpy(arg_ref.data, arg.len + 1, arg_ref.datalen);
return arg_ref;
}
LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
//TODO: jobject obj = get object we can call against on j_calls->o
int8_tArray arg; // TODO: Call get_shutdown_pubkey on j_calls with instance obj, returning an object);
LDKPublicKey arg_ref;
- CHECK(arg.len == 33);
- memcpy(arg_ref.compressed_form, arg.ptr, 33);
+ CHECK(*arg.len == 33);
+ memcpy(arg_ref.compressed_form, arg.len + 1, 33);
return arg_ref;
}
LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
//TODO: jobject obj = get object we can call against on j_calls->o
int8_tArray arg; // TODO: Call get_secure_random_bytes on j_calls with instance obj, returning an object);
LDKThirtyTwoBytes arg_ref;
- CHECK(arg.len == 32);
- memcpy(arg_ref.data, arg.ptr, 32);
+ CHECK(*arg.len == 32);
+ memcpy(arg_ref.data, arg.len + 1, 32);
return arg_ref;
}
LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
LDKu8slice reader_var = reader;
- int8_tArray reader_arr = { .len = reader_var.datalen, .ptr = MALLOC(reader_var.datalen, "Native int8_tArray Bytes") };
- memcpy(reader_arr.ptr, reader_var.data, reader_var.datalen);
+ int8_tArray reader_arr = { .len = MALLOC(reader_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(reader_arr.len + 1, reader_var.data, reader_var.datalen);
//TODO: jobject obj = get object we can call against on j_calls->o
LDKCResult_ChanKeySignerDecodeErrorZ* ret; // TODO: Call read_chan_signer on j_calls with instance obj, returning a pointer, reader_arr);
LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)ret;
}
int8_tArray KeysInterface_1get_1node_1secret(void* ctx_TODO, uint32_t this_arg) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
- int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
+ int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
return arg_arr;
}
int8_tArray KeysInterface_1get_1destination_1script(void* ctx_TODO, uint32_t this_arg) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
int8_tArray KeysInterface_1get_1shutdown_1pubkey(void* ctx_TODO, uint32_t this_arg) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
return arg_arr;
}
int8_tArray KeysInterface_1get_1secure_1random_1bytes(void* ctx_TODO, uint32_t this_arg) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
- int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
+ int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
return arg_arr;
}
uint32_t KeysInterface_1read_1chan_1signer(void* ctx_TODO, uint32_t this_arg, int8_tArray reader) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
LDKu8slice reader_ref;
- reader_ref.datalen = reader.len;
- reader_ref.data = reader.ptr;
+ reader_ref.datalen = *reader.len;
+ reader_ref.data = (int8_t*)(reader.len + 1);
LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
*ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
return (long)ret_conv;
uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
LDKThirtyTwoBytes a_ref;
- CHECK(a.len == 32);
- memcpy(a_ref.data, a.ptr, 32);
+ CHECK(*a.len == 32);
+ memcpy(a_ref.data, a.len + 1, 32);
ret->a = a_ref;
LDKChannelManager b_conv;
b_conv.inner = (void*)(b & (~1));
}
int8_tArray LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(void* ctx_TODO, uint32_t ptr) {
LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
- int8_tArray a_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(a_arr.ptr, tuple->a.data, 32);
+ int8_tArray a_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(a_arr.len + 1, tuple->a.data, 32);
return a_arr;
}
uint32_t LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(void* ctx_TODO, uint32_t ptr) {
}
uint32_t LDKCVec_1u64Z_1new(void* ctx_TODO, int64_tArray elems) {
LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
- int64_t *java_elems = (int64_t*)elems.ptr;
+ int64_t *java_elems = (int64_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
ret->data[i] = java_elems[i];
}
}
uint32_t LDKCVec_1UpdateAddHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKUpdateAddHTLC arr_elem_conv;
}
uint32_t LDKCVec_1UpdateFulfillHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKUpdateFulfillHTLC arr_elem_conv;
}
uint32_t LDKCVec_1UpdateFailHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKUpdateFailHTLC arr_elem_conv;
}
uint32_t LDKCVec_1UpdateFailMalformedHTLCZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKUpdateFailMalformedHTLC arr_elem_conv;
}
uint32_t LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_elem;
}
uint32_t LDKCVec_1NodeAnnouncementZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKNodeAnnouncement arr_elem_conv;
LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
CHECK(val->result_ok);
LDKCVec_u8Z res_var = (*val->contents.result);
- int8_tArray res_arr = { .len = res_var.datalen, .ptr = MALLOC(res_var.datalen, "Native int8_tArray Bytes") };
- memcpy(res_arr.ptr, res_var.data, res_var.datalen);
+ int8_tArray res_arr = { .len = MALLOC(res_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(res_arr.len + 1, res_var.data, res_var.datalen);
return res_arr;
}
uint32_t LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
int8_tArray LDKCResult_1SecretKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
CHECK(val->result_ok);
- int8_tArray res_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(res_arr.ptr, (*val->contents.result).bytes, 32);
+ int8_tArray res_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(res_arr.len + 1, (*val->contents.result).bytes, 32);
return res_arr;
}
uint32_t LDKCResult_1SecretKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
int8_tArray LDKCResult_1PublicKeySecpErrorZ_1get_1ok (void* ctx_TODO, uint32_t arg) {
LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
CHECK(val->result_ok);
- int8_tArray res_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(res_arr.ptr, (*val->contents.result).compressed_form, 33);
+ int8_tArray res_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(res_arr.len + 1, (*val->contents.result).compressed_form, 33);
return res_arr;
}
uint32_t LDKCResult_1PublicKeySecpErrorZ_1get_1err (void* ctx_TODO, uint32_t arg) {
}
uint32_t LDKCVec_1RouteHopZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKRouteHop arr_elem_conv;
}
uint32_t LDKCVec_1RouteHintZ_1new(void* ctx_TODO, uint32_tArray elems) {
LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
- ret->datalen = elems.len;
+ ret->datalen = *elems.len;
if (ret->datalen == 0) {
ret->data = NULL;
} else {
ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
- uint32_t *java_elems = (uint32_t*)elems.ptr;
+ uint32_t *java_elems = (uint32_t*)(elems.len + 1);
for (size_t i = 0; i < ret->datalen; i++) {
uint32_t arr_elem = java_elems[i];
LDKRouteHint arr_elem_conv;
//TODO: jobject obj = get object we can call against on j_calls->o
uint32_tArray arg; // TODO: Call get_and_clear_pending_msg_events on j_calls with instance obj, returning an object);
LDKCVec_MessageSendEventZ arg_constr;
- arg_constr.datalen = arg.len;
+ arg_constr.datalen = *arg.len;
if (arg_constr.datalen > 0)
arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
else
arg_constr.data = NULL;
- uint32_t* arg_vals = (uint32_t*) arg.ptr;
+ uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
for (size_t s = 0; s < arg_constr.datalen; s++) {
uint32_t arr_conv_18 = arg_vals[s];
LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
uint32_tArray MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(void* ctx_TODO, uint32_t this_arg) {
LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t s = 0; s < ret_var.datalen; s++) {
LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
*arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
//TODO: jobject obj = get object we can call against on j_calls->o
uint32_tArray arg; // TODO: Call get_and_clear_pending_events on j_calls with instance obj, returning an object);
LDKCVec_EventZ arg_constr;
- arg_constr.datalen = arg.len;
+ arg_constr.datalen = *arg.len;
if (arg_constr.datalen > 0)
arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
else
arg_constr.data = NULL;
- uint32_t* arg_vals = (uint32_t*) arg.ptr;
+ uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
for (size_t h = 0; h < arg_constr.datalen; h++) {
uint32_t arr_conv_7 = arg_vals[h];
LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
uint32_tArray EventsProvider_1get_1and_1clear_1pending_1events(void* ctx_TODO, uint32_t this_arg) {
LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t h = 0; h < ret_var.datalen; h++) {
LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*arr_conv_7_copy = Event_clone(&ret_var.data[h]);
}
LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- int8_tArray genesis_hash_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(genesis_hash_arr.ptr, *genesis_hash, 32);
+ int8_tArray genesis_hash_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(genesis_hash_arr.len + 1, *genesis_hash, 32);
//TODO: jobject obj = get object we can call against on j_calls->o
LDKCResult_TxOutAccessErrorZ* ret; // TODO: Call get_utxo on j_calls with instance obj, returning a pointer, genesis_hash_arr, short_channel_id);
LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
uint32_t Access_1get_1utxo(void* ctx_TODO, uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
unsigned char genesis_hash_arr[32];
- CHECK(genesis_hash.len == 32);
- memcpy(genesis_hash_arr, genesis_hash.ptr, 32);
+ CHECK(*genesis_hash.len == 32);
+ memcpy(genesis_hash_arr, genesis_hash.len + 1, 32);
unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
*ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
}
void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- int8_tArray txid_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(txid_arr.ptr, *txid, 32);
+ int8_tArray txid_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(txid_arr.len + 1, *txid, 32);
LDKu8slice script_pubkey_var = script_pubkey;
- int8_tArray script_pubkey_arr = { .len = script_pubkey_var.datalen, .ptr = MALLOC(script_pubkey_var.datalen, "Native int8_tArray Bytes") };
- memcpy(script_pubkey_arr.ptr, script_pubkey_var.data, script_pubkey_var.datalen);
+ int8_tArray script_pubkey_arr = { .len = MALLOC(script_pubkey_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(script_pubkey_arr.len + 1, script_pubkey_var.data, script_pubkey_var.datalen);
//TODO: jobject obj = get object we can call against on j_calls->o
return; //TODO: Call register_tx on j_calls with instance obj, txid_arr, script_pubkey_arr);
}
outpoint_ref |= 1;
}
LDKu8slice script_pubkey_var = script_pubkey;
- int8_tArray script_pubkey_arr = { .len = script_pubkey_var.datalen, .ptr = MALLOC(script_pubkey_var.datalen, "Native int8_tArray Bytes") };
- memcpy(script_pubkey_arr.ptr, script_pubkey_var.data, script_pubkey_var.datalen);
+ int8_tArray script_pubkey_arr = { .len = MALLOC(script_pubkey_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(script_pubkey_arr.len + 1, script_pubkey_var.data, script_pubkey_var.datalen);
//TODO: jobject obj = get object we can call against on j_calls->o
return; //TODO: Call register_output on j_calls with instance obj, outpoint_ref, script_pubkey_arr);
}
void Filter_1register_1tx(void* ctx_TODO, uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
unsigned char txid_arr[32];
- CHECK(txid.len == 32);
- memcpy(txid_arr, txid.ptr, 32);
+ CHECK(*txid.len == 32);
+ memcpy(txid_arr, txid.len + 1, 32);
unsigned char (*txid_ref)[32] = &txid_arr;
LDKu8slice script_pubkey_ref;
- script_pubkey_ref.datalen = script_pubkey.len;
- script_pubkey_ref.data = script_pubkey.ptr;
+ script_pubkey_ref.datalen = *script_pubkey.len;
+ script_pubkey_ref.data = (int8_t*)(script_pubkey.len + 1);
(this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
}
outpoint_conv.inner = (void*)(outpoint & (~1));
outpoint_conv.is_owned = false;
LDKu8slice script_pubkey_ref;
- script_pubkey_ref.datalen = script_pubkey.len;
- script_pubkey_ref.data = script_pubkey.ptr;
+ script_pubkey_ref.datalen = *script_pubkey.len;
+ script_pubkey_ref.data = (int8_t*)(script_pubkey.len + 1);
(this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
}
}
void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKInitFeatures their_features_var = their_features;
CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
}
void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKInitFeatures their_features_var = their_features;
CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
}
void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKFundingCreated msg_var = *msg;
if (msg->inner != NULL)
msg_var = FundingCreated_clone(msg);
}
void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKFundingSigned msg_var = *msg;
if (msg->inner != NULL)
msg_var = FundingSigned_clone(msg);
}
void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKFundingLocked msg_var = *msg;
if (msg->inner != NULL)
msg_var = FundingLocked_clone(msg);
}
void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKShutdown msg_var = *msg;
if (msg->inner != NULL)
msg_var = Shutdown_clone(msg);
}
void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKClosingSigned msg_var = *msg;
if (msg->inner != NULL)
msg_var = ClosingSigned_clone(msg);
}
void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKUpdateAddHTLC msg_var = *msg;
if (msg->inner != NULL)
msg_var = UpdateAddHTLC_clone(msg);
}
void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKUpdateFulfillHTLC msg_var = *msg;
if (msg->inner != NULL)
msg_var = UpdateFulfillHTLC_clone(msg);
}
void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKUpdateFailHTLC msg_var = *msg;
if (msg->inner != NULL)
msg_var = UpdateFailHTLC_clone(msg);
}
void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKUpdateFailMalformedHTLC msg_var = *msg;
if (msg->inner != NULL)
msg_var = UpdateFailMalformedHTLC_clone(msg);
}
void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKCommitmentSigned msg_var = *msg;
if (msg->inner != NULL)
msg_var = CommitmentSigned_clone(msg);
}
void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKRevokeAndACK msg_var = *msg;
if (msg->inner != NULL)
msg_var = RevokeAndACK_clone(msg);
}
void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKUpdateFee msg_var = *msg;
if (msg->inner != NULL)
msg_var = UpdateFee_clone(msg);
}
void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKAnnouncementSignatures msg_var = *msg;
if (msg->inner != NULL)
msg_var = AnnouncementSignatures_clone(msg);
}
void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
//TODO: jobject obj = get object we can call against on j_calls->o
return; //TODO: Call peer_disconnected on j_calls with instance obj, their_node_id_arr, no_connection_possible);
}
void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKInit msg_var = *msg;
if (msg->inner != NULL)
msg_var = Init_clone(msg);
}
void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKChannelReestablish msg_var = *msg;
if (msg->inner != NULL)
msg_var = ChannelReestablish_clone(msg);
}
void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKErrorMessage msg_var = *msg;
if (msg->inner != NULL)
msg_var = ErrorMessage_clone(msg);
void ChannelMessageHandler_1handle_1open_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKInitFeatures their_features_conv;
their_features_conv.inner = (void*)(their_features & (~1));
their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
void ChannelMessageHandler_1handle_1accept_1channel(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKInitFeatures their_features_conv;
their_features_conv.inner = (void*)(their_features & (~1));
their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
void ChannelMessageHandler_1handle_1funding_1created(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKFundingCreated msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1funding_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKFundingSigned msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1funding_1locked(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKFundingLocked msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1shutdown(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKShutdown msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1closing_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKClosingSigned msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1update_1add_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKUpdateAddHTLC msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1update_1fulfill_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKUpdateFulfillHTLC msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1update_1fail_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKUpdateFailHTLC msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKUpdateFailMalformedHTLC msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1commitment_1signed(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKCommitmentSigned msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1revoke_1and_1ack(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKRevokeAndACK msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1update_1fee(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKUpdateFee msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1announcement_1signatures(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKAnnouncementSignatures msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1peer_1disconnected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
(this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
}
void ChannelMessageHandler_1peer_1connected(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKInit msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1channel_1reestablish(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKChannelReestablish msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
void ChannelMessageHandler_1handle_1error(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKErrorMessage msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
//TODO: jobject obj = get object we can call against on j_calls->o
uint32_tArray arg; // TODO: Call get_next_channel_announcements on j_calls with instance obj, returning an object, starting_point, batch_amount);
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
- arg_constr.datalen = arg.len;
+ arg_constr.datalen = *arg.len;
if (arg_constr.datalen > 0)
arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
else
arg_constr.data = NULL;
- uint32_t* arg_vals = (uint32_t*) arg.ptr;
+ uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
for (size_t l = 0; l < arg_constr.datalen; l++) {
uint32_t arr_conv_63 = arg_vals[l];
LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
}
LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- int8_tArray starting_point_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(starting_point_arr.ptr, starting_point.compressed_form, 33);
+ int8_tArray starting_point_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(starting_point_arr.len + 1, starting_point.compressed_form, 33);
//TODO: jobject obj = get object we can call against on j_calls->o
uint32_tArray arg; // TODO: Call get_next_node_announcements on j_calls with instance obj, returning an object, starting_point_arr, batch_amount);
LDKCVec_NodeAnnouncementZ arg_constr;
- arg_constr.datalen = arg.len;
+ arg_constr.datalen = *arg.len;
if (arg_constr.datalen > 0)
arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
else
arg_constr.data = NULL;
- uint32_t* arg_vals = (uint32_t*) arg.ptr;
+ uint32_t* arg_vals = (uint32_t*)(arg.len + 1);
for (size_t s = 0; s < arg_constr.datalen; s++) {
uint32_t arr_conv_18 = arg_vals[s];
LDKNodeAnnouncement arr_conv_18_conv;
}
void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKInit init_var = *init;
if (init->inner != NULL)
init_var = Init_clone(init);
}
LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKReplyChannelRange msg_var = msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
}
LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKReplyShortChannelIdsEnd msg_var = msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
}
LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKQueryChannelRange msg_var = msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
}
LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- int8_tArray their_node_id_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(their_node_id_arr.ptr, their_node_id.compressed_form, 33);
+ int8_tArray their_node_id_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(their_node_id_arr.len + 1, their_node_id.compressed_form, 33);
LDKQueryShortChannelIds msg_var = msg;
CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint32_tArray RoutingMessageHandler_1get_1next_1channel_1announcements(void* ctx_TODO, uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t l = 0; l < ret_var.datalen; l++) {
LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
*arr_conv_63_ref = ret_var.data[l];
uint32_tArray RoutingMessageHandler_1get_1next_1node_1announcements(void* ctx_TODO, uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
LDKPublicKey starting_point_ref;
- CHECK(starting_point.len == 33);
- memcpy(starting_point_ref.compressed_form, starting_point.ptr, 33);
+ CHECK(*starting_point.len == 33);
+ memcpy(starting_point_ref.compressed_form, starting_point.len + 1, 33);
LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t s = 0; s < ret_var.datalen; s++) {
LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
void RoutingMessageHandler_1sync_1routing_1table(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKInit init_conv;
init_conv.inner = (void*)(init & (~1));
init_conv.is_owned = false;
uint32_t RoutingMessageHandler_1handle_1reply_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKReplyChannelRange msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = (msg & 1) || (msg == 0);
uint32_t RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKReplyShortChannelIdsEnd msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = (msg & 1) || (msg == 0);
uint32_t RoutingMessageHandler_1handle_1query_1channel_1range(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKQueryChannelRange msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = (msg & 1) || (msg == 0);
uint32_t RoutingMessageHandler_1handle_1query_1short_1channel_1ids(void* ctx_TODO, uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKQueryShortChannelIds msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = (msg & 1) || (msg == 0);
uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
LDKu8slice data_var = data;
- int8_tArray data_arr = { .len = data_var.datalen, .ptr = MALLOC(data_var.datalen, "Native int8_tArray Bytes") };
- memcpy(data_arr.ptr, data_var.data, data_var.datalen);
+ int8_tArray data_arr = { .len = MALLOC(data_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(data_arr.len + 1, data_var.data, data_var.datalen);
//TODO: jobject obj = get object we can call against on j_calls->o
return 0; //TODO: Call send_data on j_calls with instance obj, returning number, data_arr, resume_read);
}
intptr_t SocketDescriptor_1send_1data(void* ctx_TODO, uint32_t this_arg, int8_tArray data, jboolean resume_read) {
LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
LDKu8slice data_ref;
- data_ref.datalen = data.len;
- data_ref.data = data.ptr;
+ data_ref.datalen = *data.len;
+ data_ref.data = (int8_t*)(data.len + 1);
intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
return ret_val;
}
void Transaction_1free(void* ctx_TODO, int8_tArray _res) {
LDKTransaction _res_ref;
- _res_ref.datalen = _res.len;
+ _res_ref.datalen = *_res.len;
_res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
- memcpy(_res_ref.data, _res.ptr, _res_ref.datalen);
+ memcpy(_res_ref.data, _res.len + 1, _res_ref.datalen);
_res_ref.data_is_owned = true;
Transaction_free(_res_ref);
}
void CVec_1SpendableOutputDescriptorZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_SpendableOutputDescriptorZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t b = 0; b < _res_constr.datalen; b++) {
uint32_t arr_conv_27 = _res_vals[b];
LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
void CVec_1MessageSendEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_MessageSendEventZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t s = 0; s < _res_constr.datalen; s++) {
uint32_t arr_conv_18 = _res_vals[s];
LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
void CVec_1EventZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_EventZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t h = 0; h < _res_constr.datalen; h++) {
uint32_t arr_conv_7 = _res_vals[h];
LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
uint32_t C2Tuple_1usizeTransactionZ_1new(void* ctx_TODO, intptr_t a, int8_tArray b) {
LDKTransaction b_ref;
- b_ref.datalen = b.len;
+ b_ref.datalen = *b.len;
b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
- memcpy(b_ref.data, b.ptr, b_ref.datalen);
+ memcpy(b_ref.data, b.len + 1, b_ref.datalen);
b_ref.data_is_owned = true;
LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
*ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
void CVec_1C2Tuple_1usizeTransactionZZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t e = 0; e < _res_constr.datalen; e++) {
uint32_t arr_conv_30 = _res_vals[e];
LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
void CVec_1MonitorEventZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_MonitorEventZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t o = 0; o < _res_constr.datalen; o++) {
uint32_t arr_conv_14 = _res_vals[o];
LDKMonitorEvent arr_conv_14_conv;
if (a_conv.inner != NULL)
a_conv = OutPoint_clone(&a_conv);
LDKCVec_u8Z b_ref;
- b_ref.datalen = b.len;
+ b_ref.datalen = *b.len;
b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(b_ref.data, b.ptr, b_ref.datalen);
+ memcpy(b_ref.data, b.len + 1, b_ref.datalen);
LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
*ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
ret_ref->a = OutPoint_clone(&ret_ref->a);
void CVec_1TransactionZ_1free(void* ctx_TODO, ptrArray _res) {
LDKCVec_TransactionZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
else
_res_constr.data = NULL;
- int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
+ int8_tArray* _res_vals = (int8_tArray*)(_res.len + 1);
for (size_t m = 0; m < _res_constr.datalen; m++) {
int8_tArray arr_conv_12 = _res_vals[m];
LDKTransaction arr_conv_12_ref;
- arr_conv_12_ref.datalen = arr_conv_12.len;
+ arr_conv_12_ref.datalen = *arr_conv_12.len;
arr_conv_12_ref.data = MALLOC(arr_conv_12_ref.datalen, "LDKTransaction Bytes");
- memcpy(arr_conv_12_ref.data, arr_conv_12.ptr, arr_conv_12_ref.datalen);
+ memcpy(arr_conv_12_ref.data, arr_conv_12.len + 1, arr_conv_12_ref.datalen);
arr_conv_12_ref.data_is_owned = true;
_res_constr.data[m] = arr_conv_12_ref;
}
void CVec_1C2Tuple_1u32TxOutZZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t z = 0; z < _res_constr.datalen; z++) {
uint32_t arr_conv_25 = _res_vals[z];
LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
uint32_t C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(void* ctx_TODO, int8_tArray a, uint32_tArray b) {
LDKThirtyTwoBytes a_ref;
- CHECK(a.len == 32);
- memcpy(a_ref.data, a.ptr, 32);
+ CHECK(*a.len == 32);
+ memcpy(a_ref.data, a.len + 1, 32);
LDKCVec_C2Tuple_u32TxOutZZ b_constr;
- b_constr.datalen = b.len;
+ b_constr.datalen = *b.len;
if (b_constr.datalen > 0)
b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
else
b_constr.data = NULL;
- uint32_t* b_vals = (uint32_t*) b.ptr;
+ uint32_t* b_vals = (uint32_t*)(b.len + 1);
for (size_t z = 0; z < b_constr.datalen; z++) {
uint32_t arr_conv_25 = b_vals[z];
LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_25;
void CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t x = 0; x < _res_constr.datalen; x++) {
uint32_t arr_conv_49 = _res_vals[x];
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_conv_49;
uint32_t C2Tuple_1BlockHashChannelMonitorZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
LDKThirtyTwoBytes a_ref;
- CHECK(a.len == 32);
- memcpy(a_ref.data, a.ptr, 32);
+ CHECK(*a.len == 32);
+ memcpy(a_ref.data, a.len + 1, 32);
LDKChannelMonitor b_conv;
b_conv.inner = (void*)(b & (~1));
b_conv.is_owned = (b & 1) || (b == 0);
void CVec_1SignatureZ_1free(void* ctx_TODO, ptrArray _res) {
LDKCVec_SignatureZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
_res_constr.data = NULL;
- int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
+ int8_tArray* _res_vals = (int8_tArray*)(_res.len + 1);
for (size_t m = 0; m < _res_constr.datalen; m++) {
int8_tArray arr_conv_12 = _res_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
_res_constr.data[m] = arr_conv_12_ref;
}
CVec_SignatureZ_free(_res_constr);
uint32_t C2Tuple_1SignatureCVec_1SignatureZZ_1new(void* ctx_TODO, int8_tArray a, ptrArray b) {
LDKSignature a_ref;
- CHECK(a.len == 64);
- memcpy(a_ref.compact_form, a.ptr, 64);
+ CHECK(*a.len == 64);
+ memcpy(a_ref.compact_form, a.len + 1, 64);
LDKCVec_SignatureZ b_constr;
- b_constr.datalen = b.len;
+ b_constr.datalen = *b.len;
if (b_constr.datalen > 0)
b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
b_constr.data = NULL;
- int8_tArray* b_vals = (int8_tArray*) b.ptr;
+ int8_tArray* b_vals = (int8_tArray*)(b.len + 1);
for (size_t m = 0; m < b_constr.datalen; m++) {
int8_tArray arr_conv_12 = b_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
b_constr.data[m] = arr_conv_12_ref;
}
LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
uint32_t CResult_1SignatureNoneZ_1ok(void* ctx_TODO, int8_tArray o) {
LDKSignature o_ref;
- CHECK(o.len == 64);
- memcpy(o_ref.compact_form, o.ptr, 64);
+ CHECK(*o.len == 64);
+ memcpy(o_ref.compact_form, o.len + 1, 64);
LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
*ret_conv = CResult_SignatureNoneZ_ok(o_ref);
return (long)ret_conv;
uint32_t CResult_1CVec_1SignatureZNoneZ_1ok(void* ctx_TODO, ptrArray o) {
LDKCVec_SignatureZ o_constr;
- o_constr.datalen = o.len;
+ o_constr.datalen = *o.len;
if (o_constr.datalen > 0)
o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
o_constr.data = NULL;
- int8_tArray* o_vals = (int8_tArray*) o.ptr;
+ int8_tArray* o_vals = (int8_tArray*)(o.len + 1);
for (size_t m = 0; m < o_constr.datalen; m++) {
int8_tArray arr_conv_12 = o_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
o_constr.data[m] = arr_conv_12_ref;
}
LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
void CVec_1ChannelDetailsZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_ChannelDetailsZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t q = 0; q < _res_constr.datalen; q++) {
uint32_t arr_conv_16 = _res_vals[q];
LDKChannelDetails arr_conv_16_conv;
void CVec_1NetAddressZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_NetAddressZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t m = 0; m < _res_constr.datalen; m++) {
uint32_t arr_conv_12 = _res_vals[m];
LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
void CVec_1ChannelMonitorZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_ChannelMonitorZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t q = 0; q < _res_constr.datalen; q++) {
uint32_t arr_conv_16 = _res_vals[q];
LDKChannelMonitor arr_conv_16_conv;
uint32_t C2Tuple_1BlockHashChannelManagerZ_1new(void* ctx_TODO, int8_tArray a, uint32_t b) {
LDKThirtyTwoBytes a_ref;
- CHECK(a.len == 32);
- memcpy(a_ref.data, a.ptr, 32);
+ CHECK(*a.len == 32);
+ memcpy(a_ref.data, a.len + 1, 32);
LDKChannelManager b_conv;
b_conv.inner = (void*)(b & (~1));
b_conv.is_owned = (b & 1) || (b == 0);
void CVec_1u64Z_1free(void* ctx_TODO, int64_tArray _res) {
LDKCVec_u64Z _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
else
_res_constr.data = NULL;
- int64_t* _res_vals = (int64_t*) _res.ptr;
+ int64_t* _res_vals = (int64_t*)(_res.len + 1);
for (size_t i = 0; i < _res_constr.datalen; i++) {
int64_t arr_conv_8 = _res_vals[i];
_res_constr.data[i] = arr_conv_8;
void CVec_1UpdateAddHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_UpdateAddHTLCZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t p = 0; p < _res_constr.datalen; p++) {
uint32_t arr_conv_15 = _res_vals[p];
LDKUpdateAddHTLC arr_conv_15_conv;
void CVec_1UpdateFulfillHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_UpdateFulfillHTLCZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t t = 0; t < _res_constr.datalen; t++) {
uint32_t arr_conv_19 = _res_vals[t];
LDKUpdateFulfillHTLC arr_conv_19_conv;
void CVec_1UpdateFailHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_UpdateFailHTLCZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t q = 0; q < _res_constr.datalen; q++) {
uint32_t arr_conv_16 = _res_vals[q];
LDKUpdateFailHTLC arr_conv_16_conv;
void CVec_1UpdateFailMalformedHTLCZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t z = 0; z < _res_constr.datalen; z++) {
uint32_t arr_conv_25 = _res_vals[z];
LDKUpdateFailMalformedHTLC arr_conv_25_conv;
void CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t l = 0; l < _res_constr.datalen; l++) {
uint32_t arr_conv_63 = _res_vals[l];
LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
void CVec_1NodeAnnouncementZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_NodeAnnouncementZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t s = 0; s < _res_constr.datalen; s++) {
uint32_t arr_conv_18 = _res_vals[s];
LDKNodeAnnouncement arr_conv_18_conv;
void CVec_1PublicKeyZ_1free(void* ctx_TODO, ptrArray _res) {
LDKCVec_PublicKeyZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
else
_res_constr.data = NULL;
- int8_tArray* _res_vals = (int8_tArray*) _res.ptr;
+ int8_tArray* _res_vals = (int8_tArray*)(_res.len + 1);
for (size_t m = 0; m < _res_constr.datalen; m++) {
int8_tArray arr_conv_12 = _res_vals[m];
LDKPublicKey arr_conv_12_ref;
- CHECK(arr_conv_12.len == 33);
- memcpy(arr_conv_12_ref.compressed_form, arr_conv_12.ptr, 33);
+ CHECK(*arr_conv_12.len == 33);
+ memcpy(arr_conv_12_ref.compressed_form, arr_conv_12.len + 1, 33);
_res_constr.data[m] = arr_conv_12_ref;
}
CVec_PublicKeyZ_free(_res_constr);
void CVec_1u8Z_1free(void* ctx_TODO, int8_tArray _res) {
LDKCVec_u8Z _res_ref;
- _res_ref.datalen = _res.len;
+ _res_ref.datalen = *_res.len;
_res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(_res_ref.data, _res.ptr, _res_ref.datalen);
+ memcpy(_res_ref.data, _res.len + 1, _res_ref.datalen);
CVec_u8Z_free(_res_ref);
}
uint32_t CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
LDKCVec_u8Z o_ref;
- o_ref.datalen = o.len;
+ o_ref.datalen = *o.len;
o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(o_ref.data, o.ptr, o_ref.datalen);
+ memcpy(o_ref.data, o.len + 1, o_ref.datalen);
LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
*ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
return (long)ret_conv;
uint32_t CResult_1SecretKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
LDKSecretKey o_ref;
- CHECK(o.len == 32);
- memcpy(o_ref.bytes, o.ptr, 32);
+ CHECK(*o.len == 32);
+ memcpy(o_ref.bytes, o.len + 1, 32);
LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
*ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
return (long)ret_conv;
uint32_t CResult_1PublicKeySecpErrorZ_1ok(void* ctx_TODO, int8_tArray o) {
LDKPublicKey o_ref;
- CHECK(o.len == 33);
- memcpy(o_ref.compressed_form, o.ptr, 33);
+ CHECK(*o.len == 33);
+ memcpy(o_ref.compressed_form, o.len + 1, 33);
LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
*ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
return (long)ret_conv;
void CVec_1RouteHopZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_RouteHopZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t k = 0; k < _res_constr.datalen; k++) {
uint32_t arr_conv_10 = _res_vals[k];
LDKRouteHop arr_conv_10_conv;
void CVec_1CVec_1RouteHopZZ_1free(void* ctx_TODO, ptrArray _res) {
LDKCVec_CVec_RouteHopZZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
else
_res_constr.data = NULL;
- uint32_tArray* _res_vals = (uint32_tArray*) _res.ptr;
+ uint32_tArray* _res_vals = (uint32_tArray*)(_res.len + 1);
for (size_t m = 0; m < _res_constr.datalen; m++) {
uint32_tArray arr_conv_12 = _res_vals[m];
LDKCVec_RouteHopZ arr_conv_12_constr;
- arr_conv_12_constr.datalen = arr_conv_12.len;
+ arr_conv_12_constr.datalen = *arr_conv_12.len;
if (arr_conv_12_constr.datalen > 0)
arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
else
arr_conv_12_constr.data = NULL;
- uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
+ uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12.len + 1);
for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
uint32_t arr_conv_10 = arr_conv_12_vals[k];
LDKRouteHop arr_conv_10_conv;
void CVec_1RouteHintZ_1free(void* ctx_TODO, uint32_tArray _res) {
LDKCVec_RouteHintZ _res_constr;
- _res_constr.datalen = _res.len;
+ _res_constr.datalen = *_res.len;
if (_res_constr.datalen > 0)
_res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
else
_res_constr.data = NULL;
- uint32_t* _res_vals = (uint32_t*) _res.ptr;
+ uint32_t* _res_vals = (uint32_t*)(_res.len + 1);
for (size_t l = 0; l < _res_constr.datalen; l++) {
uint32_t arr_conv_11 = _res_vals[l];
LDKRouteHint arr_conv_11_conv;
int8_tArray Event_1write(void* ctx_TODO, uint32_t obj) {
LDKEvent* obj_conv = (LDKEvent*)obj;
LDKCVec_u8Z arg_var = Event_write(obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelConfig_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char header_arr[80];
- CHECK(header.len == 80);
- memcpy(header_arr, header.ptr, 80);
+ CHECK(*header.len == 80);
+ memcpy(header_arr, header.len + 1, 80);
unsigned char (*header_ref)[80] = &header_arr;
LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
- txdata_constr.datalen = txdata.len;
+ txdata_constr.datalen = *txdata.len;
if (txdata_constr.datalen > 0)
txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
else
txdata_constr.data = NULL;
- uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
+ uint32_t* txdata_vals = (uint32_t*)(txdata.len + 1);
for (size_t e = 0; e < txdata_constr.datalen; e++) {
uint32_t arr_conv_30 = txdata_vals[e];
LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char header_arr[80];
- CHECK(header.len == 80);
- memcpy(header_arr, header.ptr, 80);
+ CHECK(*header.len == 80);
+ memcpy(header_arr, header.len + 1, 80);
unsigned char (*header_ref)[80] = &header_arr;
ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelMonitorUpdate_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
*ret_conv = ChannelMonitorUpdate_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t HTLCUpdate_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t o = 0; o < ret_var.datalen; o++) {
LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t h = 0; h < ret_var.datalen; h++) {
LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*arr_conv_7_copy = Event_clone(&ret_var.data[h]);
this_arg_conv.is_owned = false;
LDKLogger* logger_conv = (LDKLogger*)logger;
LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
- ptrArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native Object Bytes") };
- int8_tArray *ret_arr_ptr = (int8_tArray*)ret_arr.ptr;
+ ptrArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
+ int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr.len + 1);
for (size_t m = 0; m < ret_var.datalen; m++) {
LDKTransaction arr_conv_12_var = ret_var.data[m];
- int8_tArray arr_conv_12_arr = { .len = arr_conv_12_var.datalen, .ptr = MALLOC(arr_conv_12_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arr_conv_12_arr.ptr, arr_conv_12_var.data, arr_conv_12_var.datalen);
+ int8_tArray arr_conv_12_arr = { .len = MALLOC(arr_conv_12_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arr_conv_12_arr.len + 1, arr_conv_12_var.data, arr_conv_12_var.datalen);
Transaction_free(arr_conv_12_var);
ret_arr_ptr[m] = arr_conv_12_arr;
}
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char header_arr[80];
- CHECK(header.len == 80);
- memcpy(header_arr, header.ptr, 80);
+ CHECK(*header.len == 80);
+ memcpy(header_arr, header.len + 1, 80);
unsigned char (*header_ref)[80] = &header_arr;
LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
- txdata_constr.datalen = txdata.len;
+ txdata_constr.datalen = *txdata.len;
if (txdata_constr.datalen > 0)
txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
else
txdata_constr.data = NULL;
- uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
+ uint32_t* txdata_vals = (uint32_t*)(txdata.len + 1);
for (size_t e = 0; e < txdata_constr.datalen; e++) {
uint32_t arr_conv_30 = txdata_vals[e];
LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
LDKLogger logger_conv = *(LDKLogger*)logger;
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);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t x = 0; x < ret_var.datalen; x++) {
LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
*arr_conv_49_ref = ret_var.data[x];
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char header_arr[80];
- CHECK(header.len == 80);
- memcpy(header_arr, header.ptr, 80);
+ CHECK(*header.len == 80);
+ memcpy(header_arr, header.len + 1, 80);
unsigned char (*header_ref)[80] = &header_arr;
LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
uint32_t C2Tuple_1BlockHashChannelMonitorZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
*ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
LDKOutPoint this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *OutPoint_get_txid(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *OutPoint_get_txid(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
OutPoint_set_txid(&this_ptr_conv, val_ref);
}
uint32_t OutPoint_1new(void* ctx_TODO, int8_tArray txid_arg, int16_t index_arg) {
LDKThirtyTwoBytes txid_arg_ref;
- CHECK(txid_arg.len == 32);
- memcpy(txid_arg_ref.data, txid_arg.ptr, 32);
+ CHECK(*txid_arg.len == 32);
+ memcpy(txid_arg_ref.data, txid_arg.len + 1, 32);
LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKOutPoint this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, OutPoint_to_channel_id(&this_arg_conv).data, 32);
+ int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, OutPoint_to_channel_id(&this_arg_conv).data, 32);
return arg_arr;
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t OutPoint_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKOutPoint ret_var = OutPoint_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
int8_tArray SpendableOutputDescriptor_1write(void* ctx_TODO, uint32_t obj) {
LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t SpendableOutputDescriptor_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
*ret_conv = SpendableOutputDescriptor_read(ser_ref);
return (long)ret_conv;
LDKInMemoryChannelKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSecretKey val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.bytes, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.bytes, val.len + 1, 32);
InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
}
LDKInMemoryChannelKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSecretKey val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.bytes, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.bytes, val.len + 1, 32);
InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
}
LDKInMemoryChannelKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSecretKey val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.bytes, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.bytes, val.len + 1, 32);
InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
}
LDKInMemoryChannelKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSecretKey val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.bytes, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.bytes, val.len + 1, 32);
InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
}
LDKInMemoryChannelKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSecretKey val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.bytes, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.bytes, val.len + 1, 32);
InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
}
LDKInMemoryChannelKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
}
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) {
LDKSecretKey funding_key_ref;
- CHECK(funding_key.len == 32);
- memcpy(funding_key_ref.bytes, funding_key.ptr, 32);
+ CHECK(*funding_key.len == 32);
+ memcpy(funding_key_ref.bytes, funding_key.len + 1, 32);
LDKSecretKey revocation_base_key_ref;
- CHECK(revocation_base_key.len == 32);
- memcpy(revocation_base_key_ref.bytes, revocation_base_key.ptr, 32);
+ CHECK(*revocation_base_key.len == 32);
+ memcpy(revocation_base_key_ref.bytes, revocation_base_key.len + 1, 32);
LDKSecretKey payment_key_ref;
- CHECK(payment_key.len == 32);
- memcpy(payment_key_ref.bytes, payment_key.ptr, 32);
+ CHECK(*payment_key.len == 32);
+ memcpy(payment_key_ref.bytes, payment_key.len + 1, 32);
LDKSecretKey delayed_payment_base_key_ref;
- CHECK(delayed_payment_base_key.len == 32);
- memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key.ptr, 32);
+ CHECK(*delayed_payment_base_key.len == 32);
+ memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key.len + 1, 32);
LDKSecretKey htlc_base_key_ref;
- CHECK(htlc_base_key.len == 32);
- memcpy(htlc_base_key_ref.bytes, htlc_base_key.ptr, 32);
+ CHECK(*htlc_base_key.len == 32);
+ memcpy(htlc_base_key_ref.bytes, htlc_base_key.len + 1, 32);
LDKThirtyTwoBytes commitment_seed_ref;
- CHECK(commitment_seed.len == 32);
- memcpy(commitment_seed_ref.data, commitment_seed.ptr, 32);
+ CHECK(*commitment_seed.len == 32);
+ memcpy(commitment_seed_ref.data, commitment_seed.len + 1, 32);
LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
FREE((void*)key_derivation_params);
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);
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t InMemoryChannelKeys_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
*ret_conv = InMemoryChannelKeys_read(ser_ref);
return (long)ret_conv;
uint32_t KeysManager_1new(void* ctx_TODO, int8_tArray seed, uint32_t network, int64_t starting_time_secs, int32_t starting_time_nanos) {
unsigned char seed_arr[32];
- CHECK(seed.len == 32);
- memcpy(seed_arr, seed.ptr, 32);
+ CHECK(*seed.len == 32);
+ memcpy(seed_arr, seed.len + 1, 32);
unsigned char (*seed_ref)[32] = &seed_arr;
LDKNetwork network_conv = LDKNetwork_from_js(network);
LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
LDKChannelDetails this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
}
LDKChannelDetails this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
}
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKPublicKey their_network_key_ref;
- CHECK(their_network_key.len == 33);
- memcpy(their_network_key_ref.compressed_form, their_network_key.ptr, 33);
+ CHECK(*their_network_key.len == 33);
+ memcpy(their_network_key_ref.compressed_form, their_network_key.len + 1, 33);
LDKUserConfig override_config_conv;
override_config_conv.inner = (void*)(override_config & (~1));
override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t q = 0; q < ret_var.datalen; q++) {
LDKChannelDetails arr_conv_16_var = ret_var.data[q];
CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
- uint32_tArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native uint32_tArray Bytes") };
- uint32_t *ret_arr_ptr = (uint32_t*)ret_arr.ptr;
+ uint32_tArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native uint32_tArray Bytes") };
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr.len + 1);
for (size_t q = 0; q < ret_var.datalen; q++) {
LDKChannelDetails arr_conv_16_var = ret_var.data[q];
CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char channel_id_arr[32];
- CHECK(channel_id.len == 32);
- memcpy(channel_id_arr, channel_id.ptr, 32);
+ CHECK(*channel_id.len == 32);
+ memcpy(channel_id_arr, channel_id.len + 1, 32);
unsigned char (*channel_id_ref)[32] = &channel_id_arr;
LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
*ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char channel_id_arr[32];
- CHECK(channel_id.len == 32);
- memcpy(channel_id_arr, channel_id.ptr, 32);
+ CHECK(*channel_id.len == 32);
+ memcpy(channel_id_arr, channel_id.len + 1, 32);
unsigned char (*channel_id_ref)[32] = &channel_id_arr;
ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
}
route_conv.inner = (void*)(route & (~1));
route_conv.is_owned = false;
LDKThirtyTwoBytes payment_hash_ref;
- CHECK(payment_hash.len == 32);
- memcpy(payment_hash_ref.data, payment_hash.ptr, 32);
+ CHECK(*payment_hash.len == 32);
+ memcpy(payment_hash_ref.data, payment_hash.len + 1, 32);
LDKThirtyTwoBytes payment_secret_ref;
- CHECK(payment_secret.len == 32);
- memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
+ CHECK(*payment_secret.len == 32);
+ memcpy(payment_secret_ref.data, payment_secret.len + 1, 32);
LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
*ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
return (long)ret_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char temporary_channel_id_arr[32];
- CHECK(temporary_channel_id.len == 32);
- memcpy(temporary_channel_id_arr, temporary_channel_id.ptr, 32);
+ CHECK(*temporary_channel_id.len == 32);
+ memcpy(temporary_channel_id_arr, temporary_channel_id.len + 1, 32);
unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
LDKOutPoint funding_txo_conv;
funding_txo_conv.inner = (void*)(funding_txo & (~1));
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKThreeBytes rgb_ref;
- CHECK(rgb.len == 3);
- memcpy(rgb_ref.data, rgb.ptr, 3);
+ CHECK(*rgb.len == 3);
+ memcpy(rgb_ref.data, rgb.len + 1, 3);
LDKThirtyTwoBytes alias_ref;
- CHECK(alias.len == 32);
- memcpy(alias_ref.data, alias.ptr, 32);
+ CHECK(*alias.len == 32);
+ memcpy(alias_ref.data, alias.len + 1, 32);
LDKCVec_NetAddressZ addresses_constr;
- addresses_constr.datalen = addresses.len;
+ addresses_constr.datalen = *addresses.len;
if (addresses_constr.datalen > 0)
addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
else
addresses_constr.data = NULL;
- uint32_t* addresses_vals = (uint32_t*) addresses.ptr;
+ uint32_t* addresses_vals = (uint32_t*)(addresses.len + 1);
for (size_t m = 0; m < addresses_constr.datalen; m++) {
uint32_t arr_conv_12 = addresses_vals[m];
LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char payment_hash_arr[32];
- CHECK(payment_hash.len == 32);
- memcpy(payment_hash_arr, payment_hash.ptr, 32);
+ CHECK(*payment_hash.len == 32);
+ memcpy(payment_hash_arr, payment_hash.len + 1, 32);
unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
LDKThirtyTwoBytes payment_secret_ref;
- CHECK(payment_secret.len == 32);
- memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
+ CHECK(*payment_secret.len == 32);
+ memcpy(payment_secret_ref.data, payment_secret.len + 1, 32);
jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
return ret_val;
}
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKThirtyTwoBytes payment_preimage_ref;
- CHECK(payment_preimage.len == 32);
- memcpy(payment_preimage_ref.data, payment_preimage.ptr, 32);
+ CHECK(*payment_preimage.len == 32);
+ memcpy(payment_preimage_ref.data, payment_preimage.len + 1, 32);
LDKThirtyTwoBytes payment_secret_ref;
- CHECK(payment_secret.len == 32);
- memcpy(payment_secret_ref.data, payment_secret.ptr, 32);
+ CHECK(*payment_secret.len == 32);
+ memcpy(payment_secret_ref.data, payment_secret.len + 1, 32);
jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
return ret_val;
}
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
return arg_arr;
}
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char header_arr[80];
- CHECK(header.len == 80);
- memcpy(header_arr, header.ptr, 80);
+ CHECK(*header.len == 80);
+ memcpy(header_arr, header.len + 1, 80);
unsigned char (*header_ref)[80] = &header_arr;
LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
- txdata_constr.datalen = txdata.len;
+ txdata_constr.datalen = *txdata.len;
if (txdata_constr.datalen > 0)
txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
else
txdata_constr.data = NULL;
- uint32_t* txdata_vals = (uint32_t*) txdata.ptr;
+ uint32_t* txdata_vals = (uint32_t*)(txdata.len + 1);
for (size_t e = 0; e < txdata_constr.datalen; e++) {
uint32_t arr_conv_30 = txdata_vals[e];
LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_30;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char header_arr[80];
- CHECK(header.len == 80);
- memcpy(header_arr, header.ptr, 80);
+ CHECK(*header.len == 80);
+ memcpy(header_arr, header.len + 1, 80);
unsigned char (*header_ref)[80] = &header_arr;
ChannelManager_block_disconnected(&this_arg_conv, header_ref);
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
if (default_config_conv.inner != NULL)
default_config_conv = UserConfig_clone(&default_config_conv);
LDKCVec_ChannelMonitorZ channel_monitors_constr;
- channel_monitors_constr.datalen = channel_monitors.len;
+ channel_monitors_constr.datalen = *channel_monitors.len;
if (channel_monitors_constr.datalen > 0)
channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
else
channel_monitors_constr.data = NULL;
- uint32_t* channel_monitors_vals = (uint32_t*) channel_monitors.ptr;
+ uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors.len + 1);
for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
uint32_t arr_conv_16 = channel_monitors_vals[q];
LDKChannelMonitor arr_conv_16_conv;
uint32_t C2Tuple_1BlockHashChannelManagerZ_1read(void* ctx_TODO, int8_tArray ser, uint32_t arg) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKChannelManagerReadArgs arg_conv;
arg_conv.inner = (void*)(arg & (~1));
arg_conv.is_owned = (arg & 1) || (arg == 0);
LDKErrorMessage this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_u8Z val_ref;
- val_ref.datalen = val.len;
+ val_ref.datalen = *val.len;
val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(val_ref.data, val.ptr, val_ref.datalen);
+ memcpy(val_ref.data, val.len + 1, val_ref.datalen);
ErrorMessage_set_data(&this_ptr_conv, val_ref);
}
uint32_t ErrorMessage_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray data_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKCVec_u8Z data_arg_ref;
- data_arg_ref.datalen = data_arg.len;
+ data_arg_ref.datalen = *data_arg.len;
data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(data_arg_ref.data, data_arg.ptr, data_arg_ref.datalen);
+ memcpy(data_arg_ref.data, data_arg.len + 1, data_arg_ref.datalen);
LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
}
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
}
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
}
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
}
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
}
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
}
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
}
LDKOpenChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
}
LDKAcceptChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
}
LDKAcceptChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
}
LDKAcceptChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
}
LDKAcceptChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
}
LDKAcceptChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
}
LDKAcceptChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
}
LDKAcceptChannel this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
}
LDKFundingCreated this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
}
LDKFundingCreated this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
}
LDKFundingCreated this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
FundingCreated_set_signature(&this_ptr_conv, val_ref);
}
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) {
LDKThirtyTwoBytes temporary_channel_id_arg_ref;
- CHECK(temporary_channel_id_arg.len == 32);
- memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg.ptr, 32);
+ CHECK(*temporary_channel_id_arg.len == 32);
+ memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg.len + 1, 32);
LDKThirtyTwoBytes funding_txid_arg_ref;
- CHECK(funding_txid_arg.len == 32);
- memcpy(funding_txid_arg_ref.data, funding_txid_arg.ptr, 32);
+ CHECK(*funding_txid_arg.len == 32);
+ memcpy(funding_txid_arg_ref.data, funding_txid_arg.len + 1, 32);
LDKSignature signature_arg_ref;
- CHECK(signature_arg.len == 64);
- memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
+ CHECK(*signature_arg.len == 64);
+ memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKFundingSigned this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
}
LDKFundingSigned this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
FundingSigned_set_signature(&this_ptr_conv, val_ref);
}
uint32_t FundingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKSignature signature_arg_ref;
- CHECK(signature_arg.len == 64);
- memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
+ CHECK(*signature_arg.len == 64);
+ memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKFundingLocked this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
}
LDKFundingLocked this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
}
uint32_t FundingLocked_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKPublicKey next_per_commitment_point_arg_ref;
- CHECK(next_per_commitment_point_arg.len == 33);
- memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.ptr, 33);
+ CHECK(*next_per_commitment_point_arg.len == 33);
+ memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.len + 1, 33);
LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKShutdown this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *Shutdown_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *Shutdown_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
Shutdown_set_channel_id(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_u8Z val_ref;
- val_ref.datalen = val.len;
+ val_ref.datalen = *val.len;
val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(val_ref.data, val.ptr, val_ref.datalen);
+ memcpy(val_ref.data, val.len + 1, val_ref.datalen);
Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
}
uint32_t Shutdown_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKCVec_u8Z scriptpubkey_arg_ref;
- scriptpubkey_arg_ref.datalen = scriptpubkey_arg.len;
+ scriptpubkey_arg_ref.datalen = *scriptpubkey_arg.len;
scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg.ptr, scriptpubkey_arg_ref.datalen);
+ memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg.len + 1, scriptpubkey_arg_ref.datalen);
LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKClosingSigned this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
}
LDKClosingSigned this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
ClosingSigned_set_signature(&this_ptr_conv, val_ref);
}
uint32_t ClosingSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKSignature signature_arg_ref;
- CHECK(signature_arg.len == 64);
- memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
+ CHECK(*signature_arg.len == 64);
+ memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKUpdateAddHTLC this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
}
LDKUpdateAddHTLC this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
}
LDKUpdateFulfillHTLC this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
}
LDKUpdateFulfillHTLC this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
}
uint32_t UpdateFulfillHTLC_1new(void* ctx_TODO, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKThirtyTwoBytes payment_preimage_arg_ref;
- CHECK(payment_preimage_arg.len == 32);
- memcpy(payment_preimage_arg_ref.data, payment_preimage_arg.ptr, 32);
+ CHECK(*payment_preimage_arg.len == 32);
+ memcpy(payment_preimage_arg_ref.data, payment_preimage_arg.len + 1, 32);
LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKUpdateFailHTLC this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
}
LDKUpdateFailMalformedHTLC this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
}
LDKCommitmentSigned this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
}
LDKCommitmentSigned this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_SignatureZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
val_constr.data = NULL;
- int8_tArray* val_vals = (int8_tArray*) val.ptr;
+ int8_tArray* val_vals = (int8_tArray*)(val.len + 1);
for (size_t m = 0; m < val_constr.datalen; m++) {
int8_tArray arr_conv_12 = val_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
val_constr.data[m] = arr_conv_12_ref;
}
CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
uint32_t CommitmentSigned_1new(void* ctx_TODO, int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKSignature signature_arg_ref;
- CHECK(signature_arg.len == 64);
- memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
+ CHECK(*signature_arg.len == 64);
+ memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
LDKCVec_SignatureZ htlc_signatures_arg_constr;
- htlc_signatures_arg_constr.datalen = htlc_signatures_arg.len;
+ htlc_signatures_arg_constr.datalen = *htlc_signatures_arg.len;
if (htlc_signatures_arg_constr.datalen > 0)
htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
htlc_signatures_arg_constr.data = NULL;
- int8_tArray* htlc_signatures_arg_vals = (int8_tArray*) htlc_signatures_arg.ptr;
+ int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg.len + 1);
for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
int8_tArray arr_conv_12 = htlc_signatures_arg_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
htlc_signatures_arg_constr.data[m] = arr_conv_12_ref;
}
LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
LDKRevokeAndACK this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
}
LDKRevokeAndACK this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
}
LDKRevokeAndACK this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
}
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) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKThirtyTwoBytes per_commitment_secret_arg_ref;
- CHECK(per_commitment_secret_arg.len == 32);
- memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg.ptr, 32);
+ CHECK(*per_commitment_secret_arg.len == 32);
+ memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg.len + 1, 32);
LDKPublicKey next_per_commitment_point_arg_ref;
- CHECK(next_per_commitment_point_arg.len == 33);
- memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.ptr, 33);
+ CHECK(*next_per_commitment_point_arg.len == 33);
+ memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg.len + 1, 33);
LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKUpdateFee this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
}
uint32_t UpdateFee_1new(void* ctx_TODO, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKDataLossProtect this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
}
LDKDataLossProtect this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
}
uint32_t DataLossProtect_1new(void* ctx_TODO, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
- CHECK(your_last_per_commitment_secret_arg.len == 32);
- memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg.ptr, 32);
+ CHECK(*your_last_per_commitment_secret_arg.len == 32);
+ memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg.len + 1, 32);
LDKPublicKey my_current_per_commitment_point_arg_ref;
- CHECK(my_current_per_commitment_point_arg.len == 33);
- memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg.ptr, 33);
+ CHECK(*my_current_per_commitment_point_arg.len == 33);
+ memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg.len + 1, 33);
LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKChannelReestablish this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
}
LDKAnnouncementSignatures this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
}
LDKAnnouncementSignatures this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
}
LDKAnnouncementSignatures this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
}
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) {
LDKThirtyTwoBytes channel_id_arg_ref;
- CHECK(channel_id_arg.len == 32);
- memcpy(channel_id_arg_ref.data, channel_id_arg.ptr, 32);
+ CHECK(*channel_id_arg.len == 32);
+ memcpy(channel_id_arg_ref.data, channel_id_arg.len + 1, 32);
LDKSignature node_signature_arg_ref;
- CHECK(node_signature_arg.len == 64);
- memcpy(node_signature_arg_ref.compact_form, node_signature_arg.ptr, 64);
+ CHECK(*node_signature_arg.len == 64);
+ memcpy(node_signature_arg_ref.compact_form, node_signature_arg.len + 1, 64);
LDKSignature bitcoin_signature_arg_ref;
- CHECK(bitcoin_signature_arg.len == 64);
- memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg.ptr, 64);
+ CHECK(*bitcoin_signature_arg.len == 64);
+ memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg.len + 1, 64);
LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
int8_tArray NetAddress_1write(void* ctx_TODO, uint32_t obj) {
LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t Result_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
*ret_conv = Result_read(ser_ref);
return (long)ret_conv;
LDKUnsignedNodeAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
}
LDKUnsignedNodeAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 3, .ptr = MALLOC(3, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
+ int8_tArray ret_arr = { .len = MALLOC(3 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThreeBytes val_ref;
- CHECK(val.len == 3);
- memcpy(val_ref.data, val.ptr, 3);
+ CHECK(*val.len == 3);
+ memcpy(val_ref.data, val.len + 1, 3);
UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
}
LDKUnsignedNodeAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_NetAddressZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
else
val_constr.data = NULL;
- uint32_t* val_vals = (uint32_t*) val.ptr;
+ uint32_t* val_vals = (uint32_t*)(val.len + 1);
for (size_t m = 0; m < val_constr.datalen; m++) {
uint32_t arr_conv_12 = val_vals[m];
LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
LDKNodeAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
}
uint32_t NodeAnnouncement_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
LDKSignature signature_arg_ref;
- CHECK(signature_arg.len == 64);
- memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
+ CHECK(*signature_arg.len == 64);
+ memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
LDKUnsignedNodeAnnouncement contents_arg_conv;
contents_arg_conv.inner = (void*)(contents_arg & (~1));
contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
LDKUnsignedChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
}
LDKUnsignedChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
}
LDKUnsignedChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
}
LDKUnsignedChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
}
LDKUnsignedChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
}
LDKChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
}
LDKChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
}
LDKChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
}
LDKChannelAnnouncement this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
}
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) {
LDKSignature node_signature_1_arg_ref;
- CHECK(node_signature_1_arg.len == 64);
- memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg.ptr, 64);
+ CHECK(*node_signature_1_arg.len == 64);
+ memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg.len + 1, 64);
LDKSignature node_signature_2_arg_ref;
- CHECK(node_signature_2_arg.len == 64);
- memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg.ptr, 64);
+ CHECK(*node_signature_2_arg.len == 64);
+ memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg.len + 1, 64);
LDKSignature bitcoin_signature_1_arg_ref;
- CHECK(bitcoin_signature_1_arg.len == 64);
- memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg.ptr, 64);
+ CHECK(*bitcoin_signature_1_arg.len == 64);
+ memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg.len + 1, 64);
LDKSignature bitcoin_signature_2_arg_ref;
- CHECK(bitcoin_signature_2_arg.len == 64);
- memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg.ptr, 64);
+ CHECK(*bitcoin_signature_2_arg.len == 64);
+ memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg.len + 1, 64);
LDKUnsignedChannelAnnouncement contents_arg_conv;
contents_arg_conv.inner = (void*)(contents_arg & (~1));
contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
LDKUnsignedChannelUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
}
LDKChannelUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
}
uint32_t ChannelUpdate_1new(void* ctx_TODO, int8_tArray signature_arg, uint32_t contents_arg) {
LDKSignature signature_arg_ref;
- CHECK(signature_arg.len == 64);
- memcpy(signature_arg_ref.compact_form, signature_arg.ptr, 64);
+ CHECK(*signature_arg.len == 64);
+ memcpy(signature_arg_ref.compact_form, signature_arg.len + 1, 64);
LDKUnsignedChannelUpdate contents_arg_conv;
contents_arg_conv.inner = (void*)(contents_arg & (~1));
contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
LDKQueryChannelRange this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
}
uint32_t QueryChannelRange_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
LDKThirtyTwoBytes chain_hash_arg_ref;
- CHECK(chain_hash_arg.len == 32);
- memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
+ CHECK(*chain_hash_arg.len == 32);
+ memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKReplyChannelRange this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_u64Z val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
else
val_constr.data = NULL;
- int64_t* val_vals = (int64_t*) val.ptr;
+ int64_t* val_vals = (int64_t*)(val.len + 1);
for (size_t i = 0; i < val_constr.datalen; i++) {
int64_t arr_conv_8 = val_vals[i];
val_constr.data[i] = arr_conv_8;
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) {
LDKThirtyTwoBytes chain_hash_arg_ref;
- CHECK(chain_hash_arg.len == 32);
- memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
+ CHECK(*chain_hash_arg.len == 32);
+ memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
LDKCVec_u64Z short_channel_ids_arg_constr;
- short_channel_ids_arg_constr.datalen = short_channel_ids_arg.len;
+ short_channel_ids_arg_constr.datalen = *short_channel_ids_arg.len;
if (short_channel_ids_arg_constr.datalen > 0)
short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
else
short_channel_ids_arg_constr.data = NULL;
- int64_t* short_channel_ids_arg_vals = (int64_t*) short_channel_ids_arg.ptr;
+ int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg.len + 1);
for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
short_channel_ids_arg_constr.data[i] = arr_conv_8;
LDKQueryShortChannelIds this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_u64Z val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
else
val_constr.data = NULL;
- int64_t* val_vals = (int64_t*) val.ptr;
+ int64_t* val_vals = (int64_t*)(val.len + 1);
for (size_t i = 0; i < val_constr.datalen; i++) {
int64_t arr_conv_8 = val_vals[i];
val_constr.data[i] = arr_conv_8;
uint32_t QueryShortChannelIds_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
LDKThirtyTwoBytes chain_hash_arg_ref;
- CHECK(chain_hash_arg.len == 32);
- memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
+ CHECK(*chain_hash_arg.len == 32);
+ memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
LDKCVec_u64Z short_channel_ids_arg_constr;
- short_channel_ids_arg_constr.datalen = short_channel_ids_arg.len;
+ short_channel_ids_arg_constr.datalen = *short_channel_ids_arg.len;
if (short_channel_ids_arg_constr.datalen > 0)
short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
else
short_channel_ids_arg_constr.data = NULL;
- int64_t* short_channel_ids_arg_vals = (int64_t*) short_channel_ids_arg.ptr;
+ int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg.len + 1);
for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
int64_t arr_conv_8 = short_channel_ids_arg_vals[i];
short_channel_ids_arg_constr.data[i] = arr_conv_8;
LDKReplyShortChannelIdsEnd this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
}
uint32_t ReplyShortChannelIdsEnd_1new(void* ctx_TODO, int8_tArray chain_hash_arg, jboolean full_information_arg) {
LDKThirtyTwoBytes chain_hash_arg_ref;
- CHECK(chain_hash_arg.len == 32);
- memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
+ CHECK(*chain_hash_arg.len == 32);
+ memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKGossipTimestampFilter this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
}
uint32_t GossipTimestampFilter_1new(void* ctx_TODO, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
LDKThirtyTwoBytes chain_hash_arg_ref;
- CHECK(chain_hash_arg.len == 32);
- memcpy(chain_hash_arg_ref.data, chain_hash_arg.ptr, 32);
+ CHECK(*chain_hash_arg.len == 32);
+ memcpy(chain_hash_arg_ref.data, chain_hash_arg.len + 1, 32);
LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_u8Z val_ref;
- val_ref.datalen = val.len;
+ val_ref.datalen = *val.len;
val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(val_ref.data, val.ptr, val_ref.datalen);
+ memcpy(val_ref.data, val.len + 1, val_ref.datalen);
LightningError_set_err(&this_ptr_conv, val_ref);
}
uint32_t LightningError_1new(void* ctx_TODO, int8_tArray err_arg, uint32_t action_arg) {
LDKCVec_u8Z err_arg_ref;
- err_arg_ref.datalen = err_arg.len;
+ err_arg_ref.datalen = *err_arg.len;
err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
- memcpy(err_arg_ref.data, err_arg.ptr, err_arg_ref.datalen);
+ memcpy(err_arg_ref.data, err_arg.len + 1, err_arg_ref.datalen);
LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
FREE((void*)action_arg);
LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_UpdateAddHTLCZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
else
val_constr.data = NULL;
- uint32_t* val_vals = (uint32_t*) val.ptr;
+ uint32_t* val_vals = (uint32_t*)(val.len + 1);
for (size_t p = 0; p < val_constr.datalen; p++) {
uint32_t arr_conv_15 = val_vals[p];
LDKUpdateAddHTLC arr_conv_15_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_UpdateFulfillHTLCZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
else
val_constr.data = NULL;
- uint32_t* val_vals = (uint32_t*) val.ptr;
+ uint32_t* val_vals = (uint32_t*)(val.len + 1);
for (size_t t = 0; t < val_constr.datalen; t++) {
uint32_t arr_conv_19 = val_vals[t];
LDKUpdateFulfillHTLC arr_conv_19_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_UpdateFailHTLCZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
else
val_constr.data = NULL;
- uint32_t* val_vals = (uint32_t*) val.ptr;
+ uint32_t* val_vals = (uint32_t*)(val.len + 1);
for (size_t q = 0; q < val_constr.datalen; q++) {
uint32_t arr_conv_16 = val_vals[q];
LDKUpdateFailHTLC arr_conv_16_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_UpdateFailMalformedHTLCZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
else
val_constr.data = NULL;
- uint32_t* val_vals = (uint32_t*) val.ptr;
+ uint32_t* val_vals = (uint32_t*)(val.len + 1);
for (size_t z = 0; z < val_constr.datalen; z++) {
uint32_t arr_conv_25 = val_vals[z];
LDKUpdateFailMalformedHTLC arr_conv_25_conv;
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) {
LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
- update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg.len;
+ update_add_htlcs_arg_constr.datalen = *update_add_htlcs_arg.len;
if (update_add_htlcs_arg_constr.datalen > 0)
update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
else
update_add_htlcs_arg_constr.data = NULL;
- uint32_t* update_add_htlcs_arg_vals = (uint32_t*) update_add_htlcs_arg.ptr;
+ uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg.len + 1);
for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
uint32_t arr_conv_15 = update_add_htlcs_arg_vals[p];
LDKUpdateAddHTLC arr_conv_15_conv;
update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
}
LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
- update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg.len;
+ update_fulfill_htlcs_arg_constr.datalen = *update_fulfill_htlcs_arg.len;
if (update_fulfill_htlcs_arg_constr.datalen > 0)
update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
else
update_fulfill_htlcs_arg_constr.data = NULL;
- uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*) update_fulfill_htlcs_arg.ptr;
+ uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg.len + 1);
for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
uint32_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
LDKUpdateFulfillHTLC arr_conv_19_conv;
update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
}
LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
- update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg.len;
+ update_fail_htlcs_arg_constr.datalen = *update_fail_htlcs_arg.len;
if (update_fail_htlcs_arg_constr.datalen > 0)
update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
else
update_fail_htlcs_arg_constr.data = NULL;
- uint32_t* update_fail_htlcs_arg_vals = (uint32_t*) update_fail_htlcs_arg.ptr;
+ uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg.len + 1);
for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
uint32_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
LDKUpdateFailHTLC arr_conv_16_conv;
update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
}
LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
- update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg.len;
+ update_fail_malformed_htlcs_arg_constr.datalen = *update_fail_malformed_htlcs_arg.len;
if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
else
update_fail_malformed_htlcs_arg_constr.data = NULL;
- uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*) update_fail_malformed_htlcs_arg.ptr;
+ uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg.len + 1);
for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
uint32_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
LDKUpdateFailMalformedHTLC arr_conv_25_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t AcceptChannel_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t AnnouncementSignatures_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelReestablish_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
*ret_conv = ChannelReestablish_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ClosingSigned_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t CommitmentSigned_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t FundingCreated_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t FundingSigned_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t FundingLocked_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = Init_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t Init_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
*ret_conv = Init_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t OpenChannel_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t RevokeAndACK_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t Shutdown_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKShutdown ret_var = Shutdown_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UpdateFailHTLC_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UpdateFailMalformedHTLC_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UpdateFee_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UpdateFulfillHTLC_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UpdateAddHTLC_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t Ping_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
*ret_conv = Ping_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t Pong_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
*ret_conv = Pong_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UnsignedChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
*ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UnsignedChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
*ret_conv = UnsignedChannelUpdate_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelUpdate_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ErrorMessage_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
*ret_conv = ErrorMessage_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t UnsignedNodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
*ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t NodeAnnouncement_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint32_t QueryShortChannelIds_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
*ret_conv = QueryShortChannelIds_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ReplyShortChannelIdsEnd_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
*ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t QueryChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
*ret_conv = QueryChannelRange_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ReplyChannelRange_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
*ret_conv = ReplyChannelRange_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t GossipTimestampFilter_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
*ret_conv = GossipTimestampFilter_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
// Warning: we may need a move here but can't clone!
LDKSecretKey our_node_secret_ref;
- CHECK(our_node_secret.len == 32);
- memcpy(our_node_secret_ref.bytes, our_node_secret.ptr, 32);
+ CHECK(*our_node_secret.len == 32);
+ memcpy(our_node_secret_ref.bytes, our_node_secret.len + 1, 32);
unsigned char ephemeral_random_data_arr[32];
- CHECK(ephemeral_random_data.len == 32);
- memcpy(ephemeral_random_data_arr, ephemeral_random_data.ptr, 32);
+ CHECK(*ephemeral_random_data.len == 32);
+ memcpy(ephemeral_random_data_arr, ephemeral_random_data.len + 1, 32);
unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
LDKLogger logger_conv = *(LDKLogger*)logger;
LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
- ptrArray ret_arr = { .len = ret_var.datalen, .ptr = MALLOC(ret_var.datalen * sizeof(int32_t), "Native Object Bytes") };
- int8_tArray *ret_arr_ptr = (int8_tArray*)ret_arr.ptr;
+ ptrArray ret_arr = { .len = MALLOC(ret_var.datalen * sizeof(int32_t) + sizeof(uint32_t), "Native Object Bytes") };
+ int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr.len + 1);
for (size_t m = 0; m < ret_var.datalen; m++) {
- int8_tArray arr_conv_12_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arr_conv_12_arr.ptr, ret_var.data[m].compressed_form, 33);
+ int8_tArray arr_conv_12_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arr_conv_12_arr.len + 1, ret_var.data[m].compressed_form, 33);
ret_arr_ptr[m] = arr_conv_12_arr;
}
FREE(ret_var.data);
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKPublicKey their_node_id_ref;
- CHECK(their_node_id.len == 33);
- memcpy(their_node_id_ref.compressed_form, their_node_id.ptr, 33);
+ CHECK(*their_node_id.len == 33);
+ memcpy(their_node_id_ref.compressed_form, their_node_id.len + 1, 33);
LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
*ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
this_arg_conv.is_owned = false;
LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
LDKu8slice data_ref;
- data_ref.datalen = data.len;
- data_ref.data = data.ptr;
+ data_ref.datalen = *data.len;
+ data_ref.data = (int8_t*)(data.len + 1);
LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
*ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
return (long)ret_conv;
int8_tArray build_1commitment_1secret(void* ctx_TODO, int8_tArray commitment_seed, int64_t idx) {
unsigned char commitment_seed_arr[32];
- CHECK(commitment_seed.len == 32);
- memcpy(commitment_seed_arr, commitment_seed.ptr, 32);
+ CHECK(*commitment_seed.len == 32);
+ memcpy(commitment_seed_arr, commitment_seed.len + 1, 32);
unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
- int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, build_commitment_secret(commitment_seed_ref, idx).data, 32);
+ int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, build_commitment_secret(commitment_seed_ref, idx).data, 32);
return arg_arr;
}
uint32_t derive_1private_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_secret) {
LDKPublicKey per_commitment_point_ref;
- CHECK(per_commitment_point.len == 33);
- memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
+ CHECK(*per_commitment_point.len == 33);
+ memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
unsigned char base_secret_arr[32];
- CHECK(base_secret.len == 32);
- memcpy(base_secret_arr, base_secret.ptr, 32);
+ CHECK(*base_secret.len == 32);
+ memcpy(base_secret_arr, base_secret.len + 1, 32);
unsigned char (*base_secret_ref)[32] = &base_secret_arr;
LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
*ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
uint32_t derive_1public_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray base_point) {
LDKPublicKey per_commitment_point_ref;
- CHECK(per_commitment_point.len == 33);
- memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
+ CHECK(*per_commitment_point.len == 33);
+ memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
LDKPublicKey base_point_ref;
- CHECK(base_point.len == 33);
- memcpy(base_point_ref.compressed_form, base_point.ptr, 33);
+ CHECK(*base_point.len == 33);
+ memcpy(base_point_ref.compressed_form, base_point.len + 1, 33);
LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
*ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
return (long)ret_conv;
uint32_t derive_1private_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
unsigned char per_commitment_secret_arr[32];
- CHECK(per_commitment_secret.len == 32);
- memcpy(per_commitment_secret_arr, per_commitment_secret.ptr, 32);
+ CHECK(*per_commitment_secret.len == 32);
+ memcpy(per_commitment_secret_arr, per_commitment_secret.len + 1, 32);
unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
unsigned char countersignatory_revocation_base_secret_arr[32];
- CHECK(countersignatory_revocation_base_secret.len == 32);
- memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret.ptr, 32);
+ CHECK(*countersignatory_revocation_base_secret.len == 32);
+ memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret.len + 1, 32);
unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
*ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
uint32_t derive_1public_1revocation_1key(void* ctx_TODO, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
LDKPublicKey per_commitment_point_ref;
- CHECK(per_commitment_point.len == 33);
- memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
+ CHECK(*per_commitment_point.len == 33);
+ memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
LDKPublicKey countersignatory_revocation_base_point_ref;
- CHECK(countersignatory_revocation_base_point.len == 33);
- memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point.ptr, 33);
+ CHECK(*countersignatory_revocation_base_point.len == 33);
+ memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point.len + 1, 33);
LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
*ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
return (long)ret_conv;
LDKTxCreationKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
}
LDKTxCreationKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
}
LDKTxCreationKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
}
LDKTxCreationKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
}
LDKTxCreationKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
}
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) {
LDKPublicKey per_commitment_point_arg_ref;
- CHECK(per_commitment_point_arg.len == 33);
- memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg.ptr, 33);
+ CHECK(*per_commitment_point_arg.len == 33);
+ memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg.len + 1, 33);
LDKPublicKey revocation_key_arg_ref;
- CHECK(revocation_key_arg.len == 33);
- memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg.ptr, 33);
+ CHECK(*revocation_key_arg.len == 33);
+ memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg.len + 1, 33);
LDKPublicKey broadcaster_htlc_key_arg_ref;
- CHECK(broadcaster_htlc_key_arg.len == 33);
- memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg.ptr, 33);
+ CHECK(*broadcaster_htlc_key_arg.len == 33);
+ memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg.len + 1, 33);
LDKPublicKey countersignatory_htlc_key_arg_ref;
- CHECK(countersignatory_htlc_key_arg.len == 33);
- memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg.ptr, 33);
+ CHECK(*countersignatory_htlc_key_arg.len == 33);
+ memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg.len + 1, 33);
LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
- CHECK(broadcaster_delayed_payment_key_arg.len == 33);
- memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg.ptr, 33);
+ CHECK(*broadcaster_delayed_payment_key_arg.len == 33);
+ memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg.len + 1, 33);
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);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t TxCreationKeys_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKChannelPublicKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
}
LDKChannelPublicKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
}
LDKChannelPublicKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
}
LDKChannelPublicKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
}
LDKChannelPublicKeys this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
}
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) {
LDKPublicKey funding_pubkey_arg_ref;
- CHECK(funding_pubkey_arg.len == 33);
- memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg.ptr, 33);
+ CHECK(*funding_pubkey_arg.len == 33);
+ memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg.len + 1, 33);
LDKPublicKey revocation_basepoint_arg_ref;
- CHECK(revocation_basepoint_arg.len == 33);
- memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg.ptr, 33);
+ CHECK(*revocation_basepoint_arg.len == 33);
+ memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg.len + 1, 33);
LDKPublicKey payment_point_arg_ref;
- CHECK(payment_point_arg.len == 33);
- memcpy(payment_point_arg_ref.compressed_form, payment_point_arg.ptr, 33);
+ CHECK(*payment_point_arg.len == 33);
+ memcpy(payment_point_arg_ref.compressed_form, payment_point_arg.len + 1, 33);
LDKPublicKey delayed_payment_basepoint_arg_ref;
- CHECK(delayed_payment_basepoint_arg.len == 33);
- memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg.ptr, 33);
+ CHECK(*delayed_payment_basepoint_arg.len == 33);
+ memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg.len + 1, 33);
LDKPublicKey htlc_basepoint_arg_ref;
- CHECK(htlc_basepoint_arg.len == 33);
- memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg.ptr, 33);
+ CHECK(*htlc_basepoint_arg.len == 33);
+ memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg.len + 1, 33);
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);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelPublicKeys_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
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) {
LDKPublicKey per_commitment_point_ref;
- CHECK(per_commitment_point.len == 33);
- memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
+ CHECK(*per_commitment_point.len == 33);
+ memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
LDKPublicKey broadcaster_delayed_payment_base_ref;
- CHECK(broadcaster_delayed_payment_base.len == 33);
- memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base.ptr, 33);
+ CHECK(*broadcaster_delayed_payment_base.len == 33);
+ memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base.len + 1, 33);
LDKPublicKey broadcaster_htlc_base_ref;
- CHECK(broadcaster_htlc_base.len == 33);
- memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base.ptr, 33);
+ CHECK(*broadcaster_htlc_base.len == 33);
+ memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base.len + 1, 33);
LDKPublicKey countersignatory_revocation_base_ref;
- CHECK(countersignatory_revocation_base.len == 33);
- memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base.ptr, 33);
+ CHECK(*countersignatory_revocation_base.len == 33);
+ memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base.len + 1, 33);
LDKPublicKey countersignatory_htlc_base_ref;
- CHECK(countersignatory_htlc_base.len == 33);
- memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base.ptr, 33);
+ CHECK(*countersignatory_htlc_base.len == 33);
+ memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base.len + 1, 33);
LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
*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);
return (long)ret_conv;
uint32_t TxCreationKeys_1from_1channel_1static_1keys(void* ctx_TODO, int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
LDKPublicKey per_commitment_point_ref;
- CHECK(per_commitment_point.len == 33);
- memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.ptr, 33);
+ CHECK(*per_commitment_point.len == 33);
+ memcpy(per_commitment_point_ref.compressed_form, per_commitment_point.len + 1, 33);
LDKChannelPublicKeys broadcaster_keys_conv;
broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
broadcaster_keys_conv.is_owned = false;
int8_tArray get_1revokeable_1redeemscript(void* ctx_TODO, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
LDKPublicKey revocation_key_ref;
- CHECK(revocation_key.len == 33);
- memcpy(revocation_key_ref.compressed_form, revocation_key.ptr, 33);
+ CHECK(*revocation_key.len == 33);
+ memcpy(revocation_key_ref.compressed_form, revocation_key.len + 1, 33);
LDKPublicKey broadcaster_delayed_payment_key_ref;
- CHECK(broadcaster_delayed_payment_key.len == 33);
- memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.ptr, 33);
+ CHECK(*broadcaster_delayed_payment_key.len == 33);
+ memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.len + 1, 33);
LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
LDKHTLCOutputInCommitment this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t HTLCOutputInCommitment_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
keys_conv.inner = (void*)(keys & (~1));
keys_conv.is_owned = false;
LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
int8_tArray make_1funding_1redeemscript(void* ctx_TODO, int8_tArray broadcaster, int8_tArray countersignatory) {
LDKPublicKey broadcaster_ref;
- CHECK(broadcaster.len == 33);
- memcpy(broadcaster_ref.compressed_form, broadcaster.ptr, 33);
+ CHECK(*broadcaster.len == 33);
+ memcpy(broadcaster_ref.compressed_form, broadcaster.len + 1, 33);
LDKPublicKey countersignatory_ref;
- CHECK(countersignatory.len == 33);
- memcpy(countersignatory_ref.compressed_form, countersignatory.ptr, 33);
+ CHECK(*countersignatory.len == 33);
+ memcpy(countersignatory_ref.compressed_form, countersignatory.len + 1, 33);
LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
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) {
unsigned char prev_hash_arr[32];
- CHECK(prev_hash.len == 32);
- memcpy(prev_hash_arr, prev_hash.ptr, 32);
+ CHECK(*prev_hash.len == 32);
+ memcpy(prev_hash_arr, prev_hash.len + 1, 32);
unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
LDKHTLCOutputInCommitment htlc_conv;
htlc_conv.inner = (void*)(htlc & (~1));
htlc_conv.is_owned = false;
LDKPublicKey broadcaster_delayed_payment_key_ref;
- CHECK(broadcaster_delayed_payment_key.len == 33);
- memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.ptr, 33);
+ CHECK(*broadcaster_delayed_payment_key.len == 33);
+ memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key.len + 1, 33);
LDKPublicKey revocation_key_ref;
- CHECK(revocation_key.len == 33);
- memcpy(revocation_key_ref.compressed_form, revocation_key.ptr, 33);
+ CHECK(*revocation_key.len == 33);
+ memcpy(revocation_key_ref.compressed_form, revocation_key.len + 1, 33);
LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
Transaction_free(arg_var);
return arg_arr;
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t CounterpartyChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelTransactionParameters_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKHolderCommitmentTransaction this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKSignature val_ref;
- CHECK(val.len == 64);
- memcpy(val_ref.compact_form, val.ptr, 64);
+ CHECK(*val.len == 64);
+ memcpy(val_ref.compact_form, val.len + 1, 64);
HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_SignatureZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
val_constr.data = NULL;
- int8_tArray* val_vals = (int8_tArray*) val.ptr;
+ int8_tArray* val_vals = (int8_tArray*)(val.len + 1);
for (size_t m = 0; m < val_constr.datalen; m++) {
int8_tArray arr_conv_12 = val_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
val_constr.data[m] = arr_conv_12_ref;
}
HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t HolderCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
if (commitment_tx_conv.inner != NULL)
commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
LDKSignature counterparty_sig_ref;
- CHECK(counterparty_sig.len == 64);
- memcpy(counterparty_sig_ref.compact_form, counterparty_sig.ptr, 64);
+ CHECK(*counterparty_sig.len == 64);
+ memcpy(counterparty_sig_ref.compact_form, counterparty_sig.len + 1, 64);
LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
- counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs.len;
+ counterparty_htlc_sigs_constr.datalen = *counterparty_htlc_sigs.len;
if (counterparty_htlc_sigs_constr.datalen > 0)
counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
else
counterparty_htlc_sigs_constr.data = NULL;
- int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*) counterparty_htlc_sigs.ptr;
+ int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs.len + 1);
for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
int8_tArray arr_conv_12 = counterparty_htlc_sigs_vals[m];
LDKSignature arr_conv_12_ref;
- CHECK(arr_conv_12.len == 64);
- memcpy(arr_conv_12_ref.compact_form, arr_conv_12.ptr, 64);
+ CHECK(*arr_conv_12.len == 64);
+ memcpy(arr_conv_12_ref.compact_form, arr_conv_12.len + 1, 64);
counterparty_htlc_sigs_constr.data[m] = arr_conv_12_ref;
}
LDKPublicKey holder_funding_key_ref;
- CHECK(holder_funding_key.len == 33);
- memcpy(holder_funding_key_ref.compressed_form, holder_funding_key.ptr, 33);
+ CHECK(*holder_funding_key.len == 33);
+ memcpy(holder_funding_key_ref.compressed_form, holder_funding_key.len + 1, 33);
LDKPublicKey counterparty_funding_key_ref;
- CHECK(counterparty_funding_key.len == 33);
- memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key.ptr, 33);
+ CHECK(*counterparty_funding_key.len == 33);
+ memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key.len + 1, 33);
LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
Transaction_free(arg_var);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTransaction val_ref;
- val_ref.datalen = val.len;
+ val_ref.datalen = *val.len;
val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
- memcpy(val_ref.data, val.ptr, val_ref.datalen);
+ memcpy(val_ref.data, val.len + 1, val_ref.datalen);
val_ref.data_is_owned = true;
BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
}
LDKBuiltCommitmentTransaction this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
}
uint32_t BuiltCommitmentTransaction_1new(void* ctx_TODO, int8_tArray transaction_arg, int8_tArray txid_arg) {
LDKTransaction transaction_arg_ref;
- transaction_arg_ref.datalen = transaction_arg.len;
+ transaction_arg_ref.datalen = *transaction_arg.len;
transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
- memcpy(transaction_arg_ref.data, transaction_arg.ptr, transaction_arg_ref.datalen);
+ memcpy(transaction_arg_ref.data, transaction_arg.len + 1, transaction_arg_ref.datalen);
transaction_arg_ref.data_is_owned = true;
LDKThirtyTwoBytes txid_arg_ref;
- CHECK(txid_arg.len == 32);
- memcpy(txid_arg_ref.data, txid_arg.ptr, 32);
+ CHECK(*txid_arg.len == 32);
+ memcpy(txid_arg_ref.data, txid_arg.len + 1, 32);
LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t BuiltCommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKu8slice funding_redeemscript_ref;
- funding_redeemscript_ref.datalen = funding_redeemscript.len;
- funding_redeemscript_ref.data = funding_redeemscript.ptr;
- int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
+ funding_redeemscript_ref.datalen = *funding_redeemscript.len;
+ funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript.len + 1);
+ int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
return arg_arr;
}
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char funding_key_arr[32];
- CHECK(funding_key.len == 32);
- memcpy(funding_key_arr, funding_key.ptr, 32);
+ CHECK(*funding_key.len == 32);
+ memcpy(funding_key_arr, funding_key.len + 1, 32);
unsigned char (*funding_key_ref)[32] = &funding_key_arr;
LDKu8slice funding_redeemscript_ref;
- funding_redeemscript_ref.datalen = funding_redeemscript.len;
- funding_redeemscript_ref.data = funding_redeemscript.ptr;
- int8_tArray arg_arr = { .len = 64, .ptr = MALLOC(64, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
+ funding_redeemscript_ref.datalen = *funding_redeemscript.len;
+ funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript.len + 1);
+ int8_tArray arg_arr = { .len = MALLOC(64 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
return arg_arr;
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t CommitmentTransaction_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKTrustedCommitmentTransaction this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
+ int8_tArray arg_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
return arg_arr;
}
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char htlc_base_key_arr[32];
- CHECK(htlc_base_key.len == 32);
- memcpy(htlc_base_key_arr, htlc_base_key.ptr, 32);
+ CHECK(*htlc_base_key.len == 32);
+ memcpy(htlc_base_key_arr, htlc_base_key.len + 1, 32);
unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
LDKDirectedChannelTransactionParameters channel_parameters_conv;
channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
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) {
LDKPublicKey broadcaster_payment_basepoint_ref;
- CHECK(broadcaster_payment_basepoint.len == 33);
- memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint.ptr, 33);
+ CHECK(*broadcaster_payment_basepoint.len == 33);
+ memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint.len + 1, 33);
LDKPublicKey countersignatory_payment_basepoint_ref;
- CHECK(countersignatory_payment_basepoint.len == 33);
- memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint.ptr, 33);
+ CHECK(*countersignatory_payment_basepoint.len == 33);
+ memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint.len + 1, 33);
int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
return ret_val;
}
LDKRouteHop this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
RouteHop_set_pubkey(&this_ptr_conv, val_ref);
}
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) {
LDKPublicKey pubkey_arg_ref;
- CHECK(pubkey_arg.len == 33);
- memcpy(pubkey_arg_ref.compressed_form, pubkey_arg.ptr, 33);
+ CHECK(*pubkey_arg.len == 33);
+ memcpy(pubkey_arg_ref.compressed_form, pubkey_arg.len + 1, 33);
LDKNodeFeatures node_features_arg_conv;
node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_CVec_RouteHopZZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
else
val_constr.data = NULL;
- uint32_tArray* val_vals = (uint32_tArray*) val.ptr;
+ uint32_tArray* val_vals = (uint32_tArray*)(val.len + 1);
for (size_t m = 0; m < val_constr.datalen; m++) {
uint32_tArray arr_conv_12 = val_vals[m];
LDKCVec_RouteHopZ arr_conv_12_constr;
- arr_conv_12_constr.datalen = arr_conv_12.len;
+ arr_conv_12_constr.datalen = *arr_conv_12.len;
if (arr_conv_12_constr.datalen > 0)
arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
else
arr_conv_12_constr.data = NULL;
- uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
+ uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12.len + 1);
for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
uint32_t arr_conv_10 = arr_conv_12_vals[k];
LDKRouteHop arr_conv_10_conv;
uint32_t Route_1new(void* ctx_TODO, ptrArray paths_arg) {
LDKCVec_CVec_RouteHopZZ paths_arg_constr;
- paths_arg_constr.datalen = paths_arg.len;
+ paths_arg_constr.datalen = *paths_arg.len;
if (paths_arg_constr.datalen > 0)
paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
else
paths_arg_constr.data = NULL;
- uint32_tArray* paths_arg_vals = (uint32_tArray*) paths_arg.ptr;
+ uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg.len + 1);
for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
uint32_tArray arr_conv_12 = paths_arg_vals[m];
LDKCVec_RouteHopZ arr_conv_12_constr;
- arr_conv_12_constr.datalen = arr_conv_12.len;
+ arr_conv_12_constr.datalen = *arr_conv_12.len;
if (arr_conv_12_constr.datalen > 0)
arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
else
arr_conv_12_constr.data = NULL;
- uint32_t* arr_conv_12_vals = (uint32_t*) arr_conv_12.ptr;
+ uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12.len + 1);
for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
uint32_t arr_conv_10 = arr_conv_12_vals[k];
LDKRouteHop arr_conv_10_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = Route_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t Route_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
*ret_conv = Route_read(ser_ref);
return (long)ret_conv;
LDKRouteHint this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
}
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) {
LDKPublicKey src_node_id_arg_ref;
- CHECK(src_node_id_arg.len == 33);
- memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg.ptr, 33);
+ CHECK(*src_node_id_arg.len == 33);
+ memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg.len + 1, 33);
LDKRoutingFees fees_arg_conv;
fees_arg_conv.inner = (void*)(fees_arg & (~1));
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
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) {
LDKPublicKey our_node_id_ref;
- CHECK(our_node_id.len == 33);
- memcpy(our_node_id_ref.compressed_form, our_node_id.ptr, 33);
+ CHECK(*our_node_id.len == 33);
+ memcpy(our_node_id_ref.compressed_form, our_node_id.len + 1, 33);
LDKNetworkGraph network_conv;
network_conv.inner = (void*)(network & (~1));
network_conv.is_owned = false;
LDKPublicKey target_ref;
- CHECK(target.len == 33);
- memcpy(target_ref.compressed_form, target.ptr, 33);
+ CHECK(*target.len == 33);
+ memcpy(target_ref.compressed_form, target.len + 1, 33);
LDKCVec_ChannelDetailsZ first_hops_constr;
- first_hops_constr.datalen = first_hops.len;
+ first_hops_constr.datalen = *first_hops.len;
if (first_hops_constr.datalen > 0)
first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
else
first_hops_constr.data = NULL;
- uint32_t* first_hops_vals = (uint32_t*) first_hops.ptr;
+ uint32_t* first_hops_vals = (uint32_t*)(first_hops.len + 1);
for (size_t q = 0; q < first_hops_constr.datalen; q++) {
uint32_t arr_conv_16 = first_hops_vals[q];
LDKChannelDetails arr_conv_16_conv;
first_hops_constr.data[q] = arr_conv_16_conv;
}
LDKCVec_RouteHintZ last_hops_constr;
- last_hops_constr.datalen = last_hops.len;
+ last_hops_constr.datalen = *last_hops.len;
if (last_hops_constr.datalen > 0)
last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
else
last_hops_constr.data = NULL;
- uint32_t* last_hops_vals = (uint32_t*) last_hops.ptr;
+ uint32_t* last_hops_vals = (uint32_t*)(last_hops.len + 1);
for (size_t l = 0; l < last_hops_constr.datalen; l++) {
uint32_t arr_conv_11 = last_hops_vals[l];
LDKRouteHint arr_conv_11_conv;
uint32_t NetGraphMsgHandler_1new(void* ctx_TODO, int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
LDKThirtyTwoBytes genesis_hash_ref;
- CHECK(genesis_hash.len == 32);
- memcpy(genesis_hash_ref.data, genesis_hash.ptr, 32);
+ CHECK(*genesis_hash.len == 32);
+ memcpy(genesis_hash_ref.data, genesis_hash.len + 1, 32);
LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
LDKLogger logger_conv = *(LDKLogger*)logger;
LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t DirectionalChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
LDKChannelInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
}
LDKChannelInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray arg_arr = { .len = 33, .ptr = MALLOC(33, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
+ int8_tArray arg_arr = { .len = MALLOC(33 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
return arg_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKPublicKey val_ref;
- CHECK(val.len == 33);
- memcpy(val_ref.compressed_form, val.ptr, 33);
+ CHECK(*val.len == 33);
+ memcpy(val_ref.compressed_form, val.len + 1, 33);
ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
}
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t ChannelInfo_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint32_t RoutingFees_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
*ret_conv = RoutingFees_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
LDKNodeAnnouncementInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 3, .ptr = MALLOC(3, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
+ int8_tArray ret_arr = { .len = MALLOC(3 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThreeBytes val_ref;
- CHECK(val.len == 3);
- memcpy(val_ref.data, val.ptr, 3);
+ CHECK(*val.len == 3);
+ memcpy(val_ref.data, val.len + 1, 3);
NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
}
LDKNodeAnnouncementInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = { .len = 32, .ptr = MALLOC(32, "Native int8_tArray Bytes") };
- memcpy(ret_arr.ptr, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
+ int8_tArray ret_arr = { .len = MALLOC(32 + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(ret_arr.len + 1, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
return ret_arr;
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKThirtyTwoBytes val_ref;
- CHECK(val.len == 32);
- memcpy(val_ref.data, val.ptr, 32);
+ CHECK(*val.len == 32);
+ memcpy(val_ref.data, val.len + 1, 32);
NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_NetAddressZ val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
else
val_constr.data = NULL;
- uint32_t* val_vals = (uint32_t*) val.ptr;
+ uint32_t* val_vals = (uint32_t*)(val.len + 1);
for (size_t m = 0; m < val_constr.datalen; m++) {
uint32_t arr_conv_12 = val_vals[m];
LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
// Warning: we may need a move here but can't clone!
LDKThreeBytes rgb_arg_ref;
- CHECK(rgb_arg.len == 3);
- memcpy(rgb_arg_ref.data, rgb_arg.ptr, 3);
+ CHECK(*rgb_arg.len == 3);
+ memcpy(rgb_arg_ref.data, rgb_arg.len + 1, 3);
LDKThirtyTwoBytes alias_arg_ref;
- CHECK(alias_arg.len == 32);
- memcpy(alias_arg_ref.data, alias_arg.ptr, 32);
+ CHECK(*alias_arg.len == 32);
+ memcpy(alias_arg_ref.data, alias_arg.len + 1, 32);
LDKCVec_NetAddressZ addresses_arg_constr;
- addresses_arg_constr.datalen = addresses_arg.len;
+ addresses_arg_constr.datalen = *addresses_arg.len;
if (addresses_arg_constr.datalen > 0)
addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
else
addresses_arg_constr.data = NULL;
- uint32_t* addresses_arg_vals = (uint32_t*) addresses_arg.ptr;
+ uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg.len + 1);
for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
uint32_t arr_conv_12 = addresses_arg_vals[m];
LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t NodeAnnouncementInfo_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
*ret_conv = NodeAnnouncementInfo_read(ser_ref);
return (long)ret_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCVec_u64Z val_constr;
- val_constr.datalen = val.len;
+ val_constr.datalen = *val.len;
if (val_constr.datalen > 0)
val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
else
val_constr.data = NULL;
- int64_t* val_vals = (int64_t*) val.ptr;
+ int64_t* val_vals = (int64_t*)(val.len + 1);
for (size_t i = 0; i < val_constr.datalen; i++) {
int64_t arr_conv_8 = val_vals[i];
val_constr.data[i] = arr_conv_8;
uint32_t NodeInfo_1new(void* ctx_TODO, int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
LDKCVec_u64Z channels_arg_constr;
- channels_arg_constr.datalen = channels_arg.len;
+ channels_arg_constr.datalen = *channels_arg.len;
if (channels_arg_constr.datalen > 0)
channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
else
channels_arg_constr.data = NULL;
- int64_t* channels_arg_vals = (int64_t*) channels_arg.ptr;
+ int64_t* channels_arg_vals = (int64_t*)(channels_arg.len + 1);
for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
int64_t arr_conv_8 = channels_arg_vals[i];
channels_arg_constr.data[i] = arr_conv_8;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t NodeInfo_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
*ret_conv = NodeInfo_read(ser_ref);
return (long)ret_conv;
obj_conv.inner = (void*)(obj & (~1));
obj_conv.is_owned = false;
LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
- int8_tArray arg_arr = { .len = arg_var.datalen, .ptr = MALLOC(arg_var.datalen, "Native int8_tArray Bytes") };
- memcpy(arg_arr.ptr, arg_var.data, arg_var.datalen);
+ int8_tArray arg_arr = { .len = MALLOC(arg_var.datalen + sizeof(uint32_t), "Native int8_tArray Bytes") };
+ memcpy(arg_arr.len + 1, arg_var.data, arg_var.datalen);
CVec_u8Z_free(arg_var);
return arg_arr;
}
uint32_t NetworkGraph_1read(void* ctx_TODO, int8_tArray ser) {
LDKu8slice ser_ref;
- ser_ref.datalen = ser.len;
- ser_ref.data = ser.ptr;
+ ser_ref.datalen = *ser.len;
+ ser_ref.data = (int8_t*)(ser.len + 1);
LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
*ret_conv = NetworkGraph_read(ser_ref);
return (long)ret_conv;
uint32_t NetworkGraph_1new(void* ctx_TODO, int8_tArray genesis_hash) {
LDKThirtyTwoBytes genesis_hash_ref;
- CHECK(genesis_hash.len == 32);
- memcpy(genesis_hash_ref.data, genesis_hash.ptr, 32);
+ CHECK(*genesis_hash.len == 32);
+ memcpy(genesis_hash_ref.data, genesis_hash.len + 1, 32);
LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.