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 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 derive_public_revocation_key) 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 == null ? 0 : val.ptr);
65 if (this != null) { this.ptrs_to.AddLast(val); };
69 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
70 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
71 * static across every commitment transaction.
73 public byte[] get_payment_point() {
74 long ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
76 if (ret >= 0 && ret <= 4096) { return null; }
77 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
82 * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
83 * spendable primary channel balance on the broadcaster's commitment transaction. This key is
84 * static across every commitment transaction.
86 public void set_payment_point(byte[] val) {
87 bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
93 * The base point which is used (with derive_public_key) to derive a per-commitment payment
94 * public key which receives non-HTLC-encumbered funds which are only available for spending
95 * after some delay (or can be claimed via the revocation path).
97 public DelayedPaymentBasepoint get_delayed_payment_basepoint() {
98 long ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
100 if (ret >= 0 && ret <= 4096) { return null; }
101 org.ldk.structs.DelayedPaymentBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentBasepoint(null, ret); }
102 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
107 * The base point which is used (with derive_public_key) to derive a per-commitment payment
108 * public key which receives non-HTLC-encumbered funds which are only available for spending
109 * after some delay (or can be claimed via the revocation path).
111 public void set_delayed_payment_basepoint(org.ldk.structs.DelayedPaymentBasepoint val) {
112 bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, val == null ? 0 : val.ptr);
115 if (this != null) { this.ptrs_to.AddLast(val); };
119 * The base point which is used (with derive_public_key) to derive a per-commitment public key
120 * which is used to encumber HTLC-in-flight outputs.
122 public HtlcBasepoint get_htlc_basepoint() {
123 long ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
125 if (ret >= 0 && ret <= 4096) { return null; }
126 org.ldk.structs.HtlcBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HtlcBasepoint(null, ret); }
127 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
132 * The base point which is used (with derive_public_key) to derive a per-commitment public key
133 * which is used to encumber HTLC-in-flight outputs.
135 public void set_htlc_basepoint(org.ldk.structs.HtlcBasepoint val) {
136 bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, val == null ? 0 : val.ptr);
139 if (this != null) { this.ptrs_to.AddLast(val); };
143 * Constructs a new ChannelPublicKeys given each field
145 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) {
146 long ret = bindings.ChannelPublicKeys_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), revocation_basepoint_arg == null ? 0 : revocation_basepoint_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_point_arg, 33)), delayed_payment_basepoint_arg == null ? 0 : delayed_payment_basepoint_arg.ptr, htlc_basepoint_arg == null ? 0 : htlc_basepoint_arg.ptr);
147 GC.KeepAlive(funding_pubkey_arg);
148 GC.KeepAlive(revocation_basepoint_arg);
149 GC.KeepAlive(payment_point_arg);
150 GC.KeepAlive(delayed_payment_basepoint_arg);
151 GC.KeepAlive(htlc_basepoint_arg);
152 if (ret >= 0 && ret <= 4096) { return null; }
153 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
155 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(revocation_basepoint_arg); };
156 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(delayed_payment_basepoint_arg); };
157 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_basepoint_arg); };
161 internal long clone_ptr() {
162 long ret = bindings.ChannelPublicKeys_clone_ptr(this.ptr);
168 * Creates a copy of the ChannelPublicKeys
170 public ChannelPublicKeys clone() {
171 long ret = bindings.ChannelPublicKeys_clone(this.ptr);
173 if (ret >= 0 && ret <= 4096) { return null; }
174 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
175 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
180 * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
183 long ret = bindings.ChannelPublicKeys_hash(this.ptr);
188 public override int GetHashCode() {
189 return (int)this.hash();
192 * Checks if two ChannelPublicKeyss contain equal inner contents.
193 * This ignores pointers and is_owned flags and looks at the values in fields.
194 * Two objects with NULL inner values will be considered "equal" here.
196 public bool eq(org.ldk.structs.ChannelPublicKeys b) {
197 bool ret = bindings.ChannelPublicKeys_eq(this.ptr, b == null ? 0 : b.ptr);
200 if (this != null) { this.ptrs_to.AddLast(b); };
204 public override bool Equals(object o) {
205 if (!(o is ChannelPublicKeys)) return false;
206 return this.eq((ChannelPublicKeys)o);
209 * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
211 public byte[] write() {
212 long ret = bindings.ChannelPublicKeys_write(this.ptr);
214 if (ret >= 0 && ret <= 4096) { return null; }
215 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
220 * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
222 public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) {
223 long ret = bindings.ChannelPublicKeys_read(InternalUtils.encodeUint8Array(ser));
225 if (ret >= 0 && ret <= 4096) { return null; }
226 Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);