6 namespace org { namespace ldk { namespace structs {
10 * Master key used in conjunction with per_commitment_point to generate [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel.
11 * A watcher can be given a [RevocationBasepoint] to generate per commitment [RevocationKey] to create justice transactions.
13 public class RevocationBasepoint : CommonBase {
14 internal RevocationBasepoint(object _dummy, long ptr) : base(ptr) { }
15 ~RevocationBasepoint() {
16 if (ptr != 0) { bindings.RevocationBasepoint_free(ptr); }
19 public byte[] get_a() {
20 long ret = bindings.RevocationBasepoint_get_a(this.ptr);
22 if (ret >= 0 && ret <= 4096) { return null; }
23 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
27 public void set_a(byte[] val) {
28 bindings.RevocationBasepoint_set_a(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
34 * Constructs a new RevocationBasepoint given each field
36 public static RevocationBasepoint of(byte[] a_arg) {
37 long ret = bindings.RevocationBasepoint_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a_arg, 33)));
39 if (ret >= 0 && ret <= 4096) { return null; }
40 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
41 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
46 * Checks if two RevocationBasepoints contain equal inner contents.
47 * This ignores pointers and is_owned flags and looks at the values in fields.
48 * Two objects with NULL inner values will be considered "equal" here.
50 public bool eq(org.ldk.structs.RevocationBasepoint b) {
51 bool ret = bindings.RevocationBasepoint_eq(this.ptr, b == null ? 0 : b.ptr);
54 if (this != null) { this.ptrs_to.AddLast(b); };
58 public override bool Equals(object o) {
59 if (!(o is RevocationBasepoint)) return false;
60 return this.eq((RevocationBasepoint)o);
62 internal long clone_ptr() {
63 long ret = bindings.RevocationBasepoint_clone_ptr(this.ptr);
69 * Creates a copy of the RevocationBasepoint
71 public RevocationBasepoint clone() {
72 long ret = bindings.RevocationBasepoint_clone(this.ptr);
74 if (ret >= 0 && ret <= 4096) { return null; }
75 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
76 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
81 * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint.
84 long ret = bindings.RevocationBasepoint_hash(this.ptr);
89 public override int GetHashCode() {
90 return (int)this.hash();
93 * Get inner Public Key
95 public byte[] to_public_key() {
96 long ret = bindings.RevocationBasepoint_to_public_key(this.ptr);
98 if (ret >= 0 && ret <= 4096) { return null; }
99 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
104 * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read
106 public byte[] write() {
107 long ret = bindings.RevocationBasepoint_write(this.ptr);
109 if (ret >= 0 && ret <= 4096) { return null; }
110 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
115 * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write
117 public static Result_RevocationBasepointDecodeErrorZ read(byte[] ser) {
118 long ret = bindings.RevocationBasepoint_read(InternalUtils.encodeUint8Array(ser));
120 if (ret >= 0 && ret <= 4096) { return null; }
121 Result_RevocationBasepointDecodeErrorZ ret_hu_conv = Result_RevocationBasepointDecodeErrorZ.constr_from_ptr(ret);