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 [`RevocationKey::from_basepoint`]) 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 RevocationBasepoint get_revocation_basepoint() {
47 long ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
49 if (ret >= 0 && ret <= 4096) { return null; }
50 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
51 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
56 * The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment
57 * revocation keys. This is combined with the per-commitment-secret generated by the
58 * counterparty to create a secret which the counterparty can reveal to revoke previous
61 public void set_revocation_basepoint(org.ldk.structs.RevocationBasepoint val) {
62 bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, val.ptr);
68 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
69 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
70 * static across every commitment transaction.
72 public byte[] get_payment_point() {
73 long ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
75 if (ret >= 0 && ret <= 4096) { return null; }
76 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
81 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
82 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
83 * static across every commitment transaction.
85 public void set_payment_point(byte[] val) {
86 bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
92 * The base point which is used (with derive_public_key) to derive a per-commitment payment
93 * public key which receives non-HTLC-encumbered funds which are only available for spending
94 * after some delay (or can be claimed via the revocation path).
96 public DelayedPaymentBasepoint get_delayed_payment_basepoint() {
97 long ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
99 if (ret >= 0 && ret <= 4096) { return null; }
100 org.ldk.structs.DelayedPaymentBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentBasepoint(null, ret); }
101 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
106 * The base point which is used (with derive_public_key) to derive a per-commitment payment
107 * public key which receives non-HTLC-encumbered funds which are only available for spending
108 * after some delay (or can be claimed via the revocation path).
110 public void set_delayed_payment_basepoint(org.ldk.structs.DelayedPaymentBasepoint val) {
111 bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, val.ptr);
117 * The base point which is used (with derive_public_key) to derive a per-commitment public key
118 * which is used to encumber HTLC-in-flight outputs.
120 public HtlcBasepoint get_htlc_basepoint() {
121 long ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
123 if (ret >= 0 && ret <= 4096) { return null; }
124 org.ldk.structs.HtlcBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HtlcBasepoint(null, ret); }
125 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
130 * The base point which is used (with derive_public_key) to derive a per-commitment public key
131 * which is used to encumber HTLC-in-flight outputs.
133 public void set_htlc_basepoint(org.ldk.structs.HtlcBasepoint val) {
134 bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, val.ptr);
140 * Constructs a new ChannelPublicKeys given each field
142 public static ChannelPublicKeys of(byte[] funding_pubkey_arg, org.ldk.structs.RevocationBasepoint revocation_basepoint_arg, byte[] payment_point_arg, org.ldk.structs.DelayedPaymentBasepoint delayed_payment_basepoint_arg, org.ldk.structs.HtlcBasepoint htlc_basepoint_arg) {
143 long ret = bindings.ChannelPublicKeys_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), revocation_basepoint_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_point_arg, 33)), delayed_payment_basepoint_arg.ptr, htlc_basepoint_arg.ptr);
144 GC.KeepAlive(funding_pubkey_arg);
145 GC.KeepAlive(revocation_basepoint_arg);
146 GC.KeepAlive(payment_point_arg);
147 GC.KeepAlive(delayed_payment_basepoint_arg);
148 GC.KeepAlive(htlc_basepoint_arg);
149 if (ret >= 0 && ret <= 4096) { return null; }
150 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
151 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
155 internal long clone_ptr() {
156 long ret = bindings.ChannelPublicKeys_clone_ptr(this.ptr);
162 * Creates a copy of the ChannelPublicKeys
164 public ChannelPublicKeys clone() {
165 long ret = bindings.ChannelPublicKeys_clone(this.ptr);
167 if (ret >= 0 && ret <= 4096) { return null; }
168 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
169 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
174 * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
177 long ret = bindings.ChannelPublicKeys_hash(this.ptr);
182 public override int GetHashCode() {
183 return (int)this.hash();
186 * Checks if two ChannelPublicKeyss contain equal inner contents.
187 * This ignores pointers and is_owned flags and looks at the values in fields.
188 * Two objects with NULL inner values will be considered "equal" here.
190 public bool eq(org.ldk.structs.ChannelPublicKeys b) {
191 bool ret = bindings.ChannelPublicKeys_eq(this.ptr, b.ptr);
194 if (this != null) { this.ptrs_to.AddLast(b); };
198 public override bool Equals(object o) {
199 if (!(o is ChannelPublicKeys)) return false;
200 return this.eq((ChannelPublicKeys)o);
203 * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
205 public byte[] write() {
206 long ret = bindings.ChannelPublicKeys_write(this.ptr);
208 if (ret >= 0 && ret <= 4096) { return null; }
209 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
214 * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
216 public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) {
217 long ret = bindings.ChannelPublicKeys_read(InternalUtils.encodeUint8Array(ser));
219 if (ret >= 0 && ret <= 4096) { return null; }
220 Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);