long ret = bindings.ChannelKeys_key_derivation_params(this.ptr);
long ret_a = bindings.LDKC2Tuple_u64u64Z_get_a(ret);
long ret_b = bindings.LDKC2Tuple_u64u64Z_get_b(ret);
- TwoTuple<Long, Long> ret_conv = new TwoTuple<Long, Long>(ret_a, ret_b);
+ TwoTuple<Long, Long> ret_conv = new TwoTuple<Long, Long>(ret_a, ret_b, () -> {
+ bindings.C2Tuple_u64u64Z_free(ret);
+ });
return ret_conv;
}
OutPoint ret_a_hu_conv = new OutPoint(null, ret_a);
ret_a_hu_conv.ptrs_to.add(this);;
byte[] ret_b = bindings.LDKC2Tuple_OutPointScriptZ_get_b(ret);
- TwoTuple<OutPoint, byte[]> ret_conv = new TwoTuple<OutPoint, byte[]>(ret_a_hu_conv, ret_b);
+ TwoTuple<OutPoint, byte[]> ret_conv = new TwoTuple<OutPoint, byte[]>(ret_a_hu_conv, ret_b, () -> {
+ bindings.C2Tuple_OutPointScriptZ_free(ret);
+ });
+ ret_a_hu_conv.ptrs_to.add(ret_conv);
return ret_conv;
}
int arr_conv_26_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(arr_conv_26);
long arr_conv_26_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(arr_conv_26));
TxOut arr_conv_26_b_conv = new TxOut(null, arr_conv_26_b);;
- TwoTuple<Integer, TxOut> arr_conv_26_conv = new TwoTuple<Integer, TxOut>(arr_conv_26_a, arr_conv_26_b_conv);
+ TwoTuple<Integer, TxOut> arr_conv_26_conv = new TwoTuple<Integer, TxOut>(arr_conv_26_a, arr_conv_26_b_conv, () -> {
+ bindings.C2Tuple_u32TxOutZ_free(arr_conv_26);
+ });
+ arr_conv_26_b_conv.ptrs_to.add(arr_conv_26_conv);
arr_conv_26_arr[a] = arr_conv_26_conv;
};
TwoTuple<byte[], TwoTuple<Integer, TxOut>[]> arr_conv_46_conv = new TwoTuple<byte[], TwoTuple<Integer, TxOut>[]>(arr_conv_46_a, arr_conv_26_arr);
+ // Warning: We may not free the C tuple object!
arr_conv_46_arr[u] = arr_conv_46_conv;
}
/* TODO 2 TwoTuple<Long, byte[]> */;
long res_b = bindings.LDKC2Tuple_BlockHashChannelManagerZ_get_b(res);
ChannelManager res_b_hu_conv = new ChannelManager(null, res_b);
res_b_hu_conv.ptrs_to.add(this);;
- TwoTuple<byte[], ChannelManager> res_conv = new TwoTuple<byte[], ChannelManager>(res_a, res_b_hu_conv);
+ TwoTuple<byte[], ChannelManager> res_conv = new TwoTuple<byte[], ChannelManager>(res_a, res_b_hu_conv, () -> {
+ bindings.C2Tuple_BlockHashChannelManagerZ_free(res);
+ });
+ res_b_hu_conv.ptrs_to.add(res_conv);
this.res = res_conv;
}
public Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_OK(TwoTuple<byte[], ChannelManager> res) {
long res_b = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_b(res);
ChannelMonitor res_b_hu_conv = new ChannelMonitor(null, res_b);
res_b_hu_conv.ptrs_to.add(this);;
- TwoTuple<byte[], ChannelMonitor> res_conv = new TwoTuple<byte[], ChannelMonitor>(res_a, res_b_hu_conv);
+ TwoTuple<byte[], ChannelMonitor> res_conv = new TwoTuple<byte[], ChannelMonitor>(res_a, res_b_hu_conv, () -> {
+ bindings.C2Tuple_BlockHashChannelMonitorZ_free(res);
+ });
+ res_b_hu_conv.ptrs_to.add(res_conv);
this.res = res_conv;
}
public Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(TwoTuple<byte[], ChannelMonitor> res) {
long res = bindings.LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(ptr);
byte[] res_a = bindings.LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(res);
byte[][] res_b = bindings.LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(res);
- TwoTuple<byte[], byte[][]> res_conv = new TwoTuple<byte[], byte[][]>(res_a, res_b);
+ TwoTuple<byte[], byte[][]> res_conv = new TwoTuple<byte[], byte[][]>(res_a, res_b, () -> {
+ bindings.C2Tuple_SignatureCVec_SignatureZZ_free(res);
+ });
this.res = res_conv;
}
public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ_OK(TwoTuple<byte[], byte[][]> res) {
long arr_conv_63_c = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(arr_conv_63);
ChannelUpdate arr_conv_63_c_hu_conv = new ChannelUpdate(null, arr_conv_63_c);
arr_conv_63_c_hu_conv.ptrs_to.add(this);;
- ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> arr_conv_63_conv = new ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>(arr_conv_63_a_hu_conv, arr_conv_63_b_hu_conv, arr_conv_63_c_hu_conv);
+ ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> arr_conv_63_conv = new ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>(arr_conv_63_a_hu_conv, arr_conv_63_b_hu_conv, arr_conv_63_c_hu_conv, () -> {
+ bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arr_conv_63);
+ });
+ arr_conv_63_a_hu_conv.ptrs_to.add(arr_conv_63_conv);
+ arr_conv_63_b_hu_conv.ptrs_to.add(arr_conv_63_conv);
+ arr_conv_63_c_hu_conv.ptrs_to.add(arr_conv_63_conv);
arr_conv_63_arr[l] = arr_conv_63_conv;
}
return arr_conv_63_arr;
long key_derivation_params = obj.key_derivation_params;
long key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params);
long key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params);
- TwoTuple<Long, Long> key_derivation_params_conv = new TwoTuple<Long, Long>(key_derivation_params_a, key_derivation_params_b);
+ TwoTuple<Long, Long> key_derivation_params_conv = new TwoTuple<Long, Long>(key_derivation_params_a, key_derivation_params_b, () -> {
+ bindings.C2Tuple_u64u64Z_free(key_derivation_params);
+ });
this.key_derivation_params = key_derivation_params_conv;
this.revocation_pubkey = obj.revocation_pubkey;
}
long key_derivation_params = obj.key_derivation_params;
long key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params);
long key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params);
- TwoTuple<Long, Long> key_derivation_params_conv = new TwoTuple<Long, Long>(key_derivation_params_a, key_derivation_params_b);
+ TwoTuple<Long, Long> key_derivation_params_conv = new TwoTuple<Long, Long>(key_derivation_params_a, key_derivation_params_b, () -> {
+ bindings.C2Tuple_u64u64Z_free(key_derivation_params);
+ });
this.key_derivation_params = key_derivation_params_conv;
}
}
FREE(err_buf);
return err_conv;
}
-static jclass arr_of_J_clz = NULL;
static jclass arr_of_B_clz = NULL;
+static jclass arr_of_J_clz = NULL;
JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
- arr_of_J_clz = (*env)->FindClass(env, "[J");
- CHECK(arr_of_J_clz != NULL);
- arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
arr_of_B_clz = (*env)->FindClass(env, "[B");
CHECK(arr_of_B_clz != NULL);
arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
+ arr_of_J_clz = (*env)->FindClass(env, "[J");
+ CHECK(arr_of_J_clz != NULL);
+ arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
}
static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
number ret = bindings.ChannelKeys_key_derivation_params(this.ptr);
number ret_a = bindings.LDKC2Tuple_u64u64Z_get_a(ret);
number ret_b = bindings.LDKC2Tuple_u64u64Z_get_b(ret);
- TwoTuple<Number, Number> ret_conv = new TwoTuple<Number, Number>(ret_a, ret_b);
+ TwoTuple<Number, Number> ret_conv = new TwoTuple<Number, Number>(ret_a, ret_b, () -> {
+ bindings.C2Tuple_u64u64Z_free(ret);
+ });
return ret_conv;
}
const ret_a_hu_conv: OutPoint = new OutPoint(null, ret_a);
ret_a_hu_conv.ptrs_to.add(this);;
Uint8Array ret_b = bindings.LDKC2Tuple_OutPointScriptZ_get_b(ret);
- TwoTuple<OutPoint, Uint8Array> ret_conv = new TwoTuple<OutPoint, Uint8Array>(ret_a_hu_conv, ret_b);
+ TwoTuple<OutPoint, Uint8Array> ret_conv = new TwoTuple<OutPoint, Uint8Array>(ret_a_hu_conv, ret_b, () -> {
+ bindings.C2Tuple_OutPointScriptZ_free(ret);
+ });
+ ret_a_hu_conv.ptrs_to.add(ret_conv);
return ret_conv;
}
number arr_conv_25_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(arr_conv_25);
number arr_conv_25_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(arr_conv_25));
TxOut arr_conv_25_b_conv = new TxOut(null, arr_conv_25_b);;
- TwoTuple<Number, TxOut> arr_conv_25_conv = new TwoTuple<Number, TxOut>(arr_conv_25_a, arr_conv_25_b_conv);
+ TwoTuple<Number, TxOut> arr_conv_25_conv = new TwoTuple<Number, TxOut>(arr_conv_25_a, arr_conv_25_b_conv, () -> {
+ bindings.C2Tuple_u32TxOutZ_free(arr_conv_25);
+ });
+ arr_conv_25_b_conv.ptrs_to.add(arr_conv_25_conv);
arr_conv_25_arr[z] = arr_conv_25_conv;
};
TwoTuple<Uint8Array, TwoTuple<Number, TxOut>[]> arr_conv_49_conv = new TwoTuple<Uint8Array, TwoTuple<Number, TxOut>[]>(arr_conv_49_a, arr_conv_25_arr);
+ // Warning: We may not free the C tuple object!
arr_conv_49_arr[x] = arr_conv_49_conv;
}
/* TODO 2 TwoTuple<Number, Uint8Array> */;
number res_b = bindings.LDKC2Tuple_BlockHashChannelManagerZ_get_b(res);
const res_b_hu_conv: ChannelManager = new ChannelManager(null, res_b);
res_b_hu_conv.ptrs_to.add(this);;
- TwoTuple<Uint8Array, ChannelManager> res_conv = new TwoTuple<Uint8Array, ChannelManager>(res_a, res_b_hu_conv);
+ TwoTuple<Uint8Array, ChannelManager> res_conv = new TwoTuple<Uint8Array, ChannelManager>(res_a, res_b_hu_conv, () -> {
+ bindings.C2Tuple_BlockHashChannelManagerZ_free(res);
+ });
+ res_b_hu_conv.ptrs_to.add(res_conv);
this.res = res_conv;
}
public Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_OK(TwoTuple<Uint8Array, ChannelManager> res) {
number res_b = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_b(res);
const res_b_hu_conv: ChannelMonitor = new ChannelMonitor(null, res_b);
res_b_hu_conv.ptrs_to.add(this);;
- TwoTuple<Uint8Array, ChannelMonitor> res_conv = new TwoTuple<Uint8Array, ChannelMonitor>(res_a, res_b_hu_conv);
+ TwoTuple<Uint8Array, ChannelMonitor> res_conv = new TwoTuple<Uint8Array, ChannelMonitor>(res_a, res_b_hu_conv, () -> {
+ bindings.C2Tuple_BlockHashChannelMonitorZ_free(res);
+ });
+ res_b_hu_conv.ptrs_to.add(res_conv);
this.res = res_conv;
}
public Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(TwoTuple<Uint8Array, ChannelMonitor> res) {
number res = bindings.LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(ptr);
Uint8Array res_a = bindings.LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(res);
Uint8Array[] res_b = bindings.LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(res);
- TwoTuple<Uint8Array, Uint8Array[]> res_conv = new TwoTuple<Uint8Array, Uint8Array[]>(res_a, res_b);
+ TwoTuple<Uint8Array, Uint8Array[]> res_conv = new TwoTuple<Uint8Array, Uint8Array[]>(res_a, res_b, () -> {
+ bindings.C2Tuple_SignatureCVec_SignatureZZ_free(res);
+ });
this.res = res_conv;
}
public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ_OK(TwoTuple<Uint8Array, Uint8Array[]> res) {
number arr_conv_63_c = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(arr_conv_63);
const arr_conv_63_c_hu_conv: ChannelUpdate = new ChannelUpdate(null, arr_conv_63_c);
arr_conv_63_c_hu_conv.ptrs_to.add(this);;
- ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> arr_conv_63_conv = new ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>(arr_conv_63_a_hu_conv, arr_conv_63_b_hu_conv, arr_conv_63_c_hu_conv);
+ ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> arr_conv_63_conv = new ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>(arr_conv_63_a_hu_conv, arr_conv_63_b_hu_conv, arr_conv_63_c_hu_conv, () -> {
+ bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arr_conv_63);
+ });
+ arr_conv_63_a_hu_conv.ptrs_to.add(arr_conv_63_conv);
+ arr_conv_63_b_hu_conv.ptrs_to.add(arr_conv_63_conv);
+ arr_conv_63_c_hu_conv.ptrs_to.add(arr_conv_63_conv);
arr_conv_63_arr[l] = arr_conv_63_conv;
}
return arr_conv_63_arr;
const key_derivation_params: number = obj.key_derivation_params;
number key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params);
number key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params);
- TwoTuple<Number, Number> key_derivation_params_conv = new TwoTuple<Number, Number>(key_derivation_params_a, key_derivation_params_b);
+ TwoTuple<Number, Number> key_derivation_params_conv = new TwoTuple<Number, Number>(key_derivation_params_a, key_derivation_params_b, () -> {
+ bindings.C2Tuple_u64u64Z_free(key_derivation_params);
+ });
this.key_derivation_params = key_derivation_params_conv;
this.revocation_pubkey = obj.revocation_pubkey;
}
const key_derivation_params: number = obj.key_derivation_params;
number key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params);
number key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params);
- TwoTuple<Number, Number> key_derivation_params_conv = new TwoTuple<Number, Number>(key_derivation_params_a, key_derivation_params_b);
+ TwoTuple<Number, Number> key_derivation_params_conv = new TwoTuple<Number, Number>(key_derivation_params_a, key_derivation_params_b, () -> {
+ bindings.C2Tuple_u64u64Z_free(key_derivation_params);
+ });
this.key_derivation_params = key_derivation_params_conv;
}
}