6 namespace org { namespace ldk { namespace structs {
10 * One counterparty's public keys which do not change over the life of a channel.
12 public class ChannelPublicKeys : CommonBase {
13 internal ChannelPublicKeys(object _dummy, long ptr) : base(ptr) { }
14 ~ChannelPublicKeys() {
15 if (ptr != 0) { bindings.ChannelPublicKeys_free(ptr); }
19 * The public key which is used to sign all commitment transactions, as it appears in the
20 * on-chain channel lock-in 2-of-2 multisig output.
22 public byte[] get_funding_pubkey() {
23 long ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr);
25 if (ret >= 0 && ret <= 4096) { return null; }
26 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
31 * The public key which is used to sign all commitment transactions, as it appears in the
32 * on-chain channel lock-in 2-of-2 multisig output.
34 public void set_funding_pubkey(byte[] val) {
35 bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
41 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
42 * revocation keys. This is combined with the per-commitment-secret generated by the
43 * counterparty to create a secret which the counterparty can reveal to revoke previous
46 public byte[] get_revocation_basepoint() {
47 long ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
49 if (ret >= 0 && ret <= 4096) { return null; }
50 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
55 * The base point which is used (with derive_public_revocation_key) to derive per-commitment
56 * revocation keys. This is combined with the per-commitment-secret generated by the
57 * counterparty to create a secret which the counterparty can reveal to revoke previous
60 public void set_revocation_basepoint(byte[] val) {
61 bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
67 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
68 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
69 * static across every commitment transaction.
71 public byte[] get_payment_point() {
72 long ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
74 if (ret >= 0 && ret <= 4096) { return null; }
75 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
80 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
81 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
82 * static across every commitment transaction.
84 public void set_payment_point(byte[] val) {
85 bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
91 * The base point which is used (with derive_public_key) to derive a per-commitment payment
92 * public key which receives non-HTLC-encumbered funds which are only available for spending
93 * after some delay (or can be claimed via the revocation path).
95 public byte[] get_delayed_payment_basepoint() {
96 long ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
104 * The base point which is used (with derive_public_key) to derive a per-commitment payment
105 * public key which receives non-HTLC-encumbered funds which are only available for spending
106 * after some delay (or can be claimed via the revocation path).
108 public void set_delayed_payment_basepoint(byte[] val) {
109 bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
115 * The base point which is used (with derive_public_key) to derive a per-commitment public key
116 * which is used to encumber HTLC-in-flight outputs.
118 public byte[] get_htlc_basepoint() {
119 long ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
121 if (ret >= 0 && ret <= 4096) { return null; }
122 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
127 * The base point which is used (with derive_public_key) to derive a per-commitment public key
128 * which is used to encumber HTLC-in-flight outputs.
130 public void set_htlc_basepoint(byte[] val) {
131 bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
137 * Constructs a new ChannelPublicKeys given each field
139 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) {
140 long ret = bindings.ChannelPublicKeys_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_point_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(htlc_basepoint_arg, 33)));
141 GC.KeepAlive(funding_pubkey_arg);
142 GC.KeepAlive(revocation_basepoint_arg);
143 GC.KeepAlive(payment_point_arg);
144 GC.KeepAlive(delayed_payment_basepoint_arg);
145 GC.KeepAlive(htlc_basepoint_arg);
146 if (ret >= 0 && ret <= 4096) { return null; }
147 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
148 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
152 internal long clone_ptr() {
153 long ret = bindings.ChannelPublicKeys_clone_ptr(this.ptr);
159 * Creates a copy of the ChannelPublicKeys
161 public ChannelPublicKeys clone() {
162 long ret = bindings.ChannelPublicKeys_clone(this.ptr);
164 if (ret >= 0 && ret <= 4096) { return null; }
165 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
166 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
171 * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
174 long ret = bindings.ChannelPublicKeys_hash(this.ptr);
179 public override int GetHashCode() {
180 return (int)this.hash();
183 * Checks if two ChannelPublicKeyss contain equal inner contents.
184 * This ignores pointers and is_owned flags and looks at the values in fields.
185 * Two objects with NULL inner values will be considered "equal" here.
187 public bool eq(org.ldk.structs.ChannelPublicKeys b) {
188 bool ret = bindings.ChannelPublicKeys_eq(this.ptr, b == null ? 0 : b.ptr);
191 if (this != null) { this.ptrs_to.AddLast(b); };
195 public override bool Equals(object o) {
196 if (!(o is ChannelPublicKeys)) return false;
197 return this.eq((ChannelPublicKeys)o);
200 * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
202 public byte[] write() {
203 long ret = bindings.ChannelPublicKeys_write(this.ptr);
205 if (ret >= 0 && ret <= 4096) { return null; }
206 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
211 * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
213 public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) {
214 long ret = bindings.ChannelPublicKeys_read(InternalUtils.encodeUint8Array(ser));
216 if (ret >= 0 && ret <= 4096) { return null; }
217 Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);