6 namespace org { namespace ldk { namespace structs {
10 * A user-defined name for a node, which may be used when displaying the node in a graph.
12 * Since node aliases are provided by third parties, they are a potential avenue for injection
13 * attacks. Care must be taken when processing.
15 public class NodeAlias : CommonBase {
16 internal NodeAlias(object _dummy, long ptr) : base(ptr) { }
18 if (ptr != 0) { bindings.NodeAlias_free(ptr); }
21 public byte[] get_a() {
22 long ret = bindings.NodeAlias_get_a(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
29 public void set_a(byte[] val) {
30 bindings.NodeAlias_set_a(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
36 * Constructs a new NodeAlias given each field
38 public static NodeAlias of(byte[] a_arg) {
39 long ret = bindings.NodeAlias_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a_arg, 32)));
41 if (ret >= 0 && ret <= 4096) { return null; }
42 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
43 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
47 internal long clone_ptr() {
48 long ret = bindings.NodeAlias_clone_ptr(this.ptr);
54 * Creates a copy of the NodeAlias
56 public NodeAlias clone() {
57 long ret = bindings.NodeAlias_clone(this.ptr);
59 if (ret >= 0 && ret <= 4096) { return null; }
60 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
61 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
66 * Generates a non-cryptographic 64-bit hash of the NodeAlias.
69 long ret = bindings.NodeAlias_hash(this.ptr);
74 public override int GetHashCode() {
75 return (int)this.hash();
78 * Checks if two NodeAliass contain equal inner contents.
79 * This ignores pointers and is_owned flags and looks at the values in fields.
80 * Two objects with NULL inner values will be considered "equal" here.
82 public bool eq(org.ldk.structs.NodeAlias b) {
83 bool ret = bindings.NodeAlias_eq(this.ptr, b.ptr);
86 if (this != null) { this.ptrs_to.AddLast(b); };
90 public override bool Equals(object o) {
91 if (!(o is NodeAlias)) return false;
92 return this.eq((NodeAlias)o);
95 * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
97 public byte[] write() {
98 long ret = bindings.NodeAlias_write(this.ptr);
100 if (ret >= 0 && ret <= 4096) { return null; }
101 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
106 * Read a NodeAlias from a byte array, created by NodeAlias_write
108 public static Result_NodeAliasDecodeErrorZ read(byte[] ser) {
109 long ret = bindings.NodeAlias_read(InternalUtils.encodeUint8Array(ser));
111 if (ret >= 0 && ret <= 4096) { return null; }
112 Result_NodeAliasDecodeErrorZ ret_hu_conv = Result_NodeAliasDecodeErrorZ.constr_from_ptr(ret);