1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * One counterparty's public keys which do not change over the life of a channel.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelPublicKeys extends CommonBase {
15 ChannelPublicKeys(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.ChannelPublicKeys_free(ptr); }
23 * The public key which is used to sign all commitment transactions, as it appears in the
24 * on-chain channel lock-in 2-of-2 multisig output.
26 public byte[] get_funding_pubkey() {
27 byte[] ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr);
32 * The public key which is used to sign all commitment transactions, as it appears in the
33 * on-chain channel lock-in 2-of-2 multisig output.
35 public void set_funding_pubkey(byte[] val) {
36 bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, val);
40 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
41 * revocation keys. This is combined with the per-commitment-secret generated by the
42 * counterparty to create a secret which the counterparty can reveal to revoke previous
45 public byte[] get_revocation_basepoint() {
46 byte[] ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
51 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
52 * revocation keys. This is combined with the per-commitment-secret generated by the
53 * counterparty to create a secret which the counterparty can reveal to revoke previous
56 public void set_revocation_basepoint(byte[] val) {
57 bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, val);
61 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
62 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
63 * static across every commitment transaction.
65 public byte[] get_payment_point() {
66 byte[] ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
71 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
72 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
73 * static across every commitment transaction.
75 public void set_payment_point(byte[] val) {
76 bindings.ChannelPublicKeys_set_payment_point(this.ptr, val);
80 * The base point which is used (with derive_public_key) to derive a per-commitment payment
81 * public key which receives non-HTLC-encumbered funds which are only available for spending
82 * after some delay (or can be claimed via the revocation path).
84 public byte[] get_delayed_payment_basepoint() {
85 byte[] ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
90 * The base point which is used (with derive_public_key) to derive a per-commitment payment
91 * public key which receives non-HTLC-encumbered funds which are only available for spending
92 * after some delay (or can be claimed via the revocation path).
94 public void set_delayed_payment_basepoint(byte[] val) {
95 bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, val);
99 * The base point which is used (with derive_public_key) to derive a per-commitment public key
100 * which is used to encumber HTLC-in-flight outputs.
102 public byte[] get_htlc_basepoint() {
103 byte[] ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
108 * The base point which is used (with derive_public_key) to derive a per-commitment public key
109 * which is used to encumber HTLC-in-flight outputs.
111 public void set_htlc_basepoint(byte[] val) {
112 bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, val);
116 * Constructs a new ChannelPublicKeys given each field
118 public static ChannelPublicKeys of(byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg) {
119 long ret = bindings.ChannelPublicKeys_new(funding_pubkey_arg, revocation_basepoint_arg, payment_point_arg, delayed_payment_basepoint_arg, htlc_basepoint_arg);
120 if (ret < 1024) { return null; }
121 ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret);
122 ret_hu_conv.ptrs_to.add(ret_hu_conv);
127 * Creates a copy of the ChannelPublicKeys
129 public ChannelPublicKeys clone() {
130 long ret = bindings.ChannelPublicKeys_clone(this.ptr);
131 if (ret < 1024) { return null; }
132 ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret);
133 ret_hu_conv.ptrs_to.add(this);
138 * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
140 public byte[] write() {
141 byte[] ret = bindings.ChannelPublicKeys_write(this.ptr);
146 * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
148 public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) {
149 long ret = bindings.ChannelPublicKeys_read(ser);
150 if (ret < 1024) { return null; }
151 Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);