1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class ChannelKeys extends CommonBase {
10 ChannelKeys(Object _dummy, long ptr) { super(ptr); }
11 public ChannelKeys(bindings.LDKChannelKeys arg) {
12 super(bindings.LDKChannelKeys_new(arg));
13 this.ptrs_to.add(arg);
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
17 bindings.ChannelKeys_free(ptr); super.finalize();
20 public byte[] get_per_commitment_point(long idx) {
21 byte[] ret = bindings.ChannelKeys_get_per_commitment_point(this.ptr, idx);
25 public byte[] release_commitment_secret(long idx) {
26 byte[] ret = bindings.ChannelKeys_release_commitment_secret(this.ptr, idx);
30 // Skipped ChannelKeys_key_derivation_params
31 // Skipped ChannelKeys_sign_counterparty_commitment
32 public Result_SignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction holder_commitment_tx) {
33 long ret = bindings.ChannelKeys_sign_holder_commitment(this.ptr, holder_commitment_tx == null ? 0 : holder_commitment_tx.ptr & ~1);
34 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
35 ret_hu_conv.ptrs_to.add(this);
36 this.ptrs_to.add(holder_commitment_tx);
40 public Result_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions(HolderCommitmentTransaction holder_commitment_tx) {
41 long ret = bindings.ChannelKeys_sign_holder_commitment_htlc_transactions(this.ptr, holder_commitment_tx == null ? 0 : holder_commitment_tx.ptr & ~1);
42 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
43 ret_hu_conv.ptrs_to.add(this);
44 this.ptrs_to.add(holder_commitment_tx);
48 // Skipped ChannelKeys_sign_justice_transaction
49 // Skipped ChannelKeys_sign_counterparty_htlc_transaction
50 // Skipped ChannelKeys_sign_closing_transaction
51 public Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) {
52 long ret = bindings.ChannelKeys_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1);
53 Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
54 ret_hu_conv.ptrs_to.add(this);
55 this.ptrs_to.add(msg);
59 public void on_accept(ChannelPublicKeys channel_points, short counterparty_selected_contest_delay, short holder_selected_contest_delay) {
60 bindings.ChannelKeys_on_accept(this.ptr, channel_points == null ? 0 : channel_points.ptr & ~1, counterparty_selected_contest_delay, holder_selected_contest_delay);
61 this.ptrs_to.add(channel_points);