6 namespace org { namespace ldk { namespace structs {
10 * A node_announcement message to be sent or received from a peer
12 public class NodeAnnouncement : CommonBase {
13 internal NodeAnnouncement(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.NodeAnnouncement_free(ptr); }
19 * The signature by the node key
21 public byte[] get_signature() {
22 byte[] ret = bindings.NodeAnnouncement_get_signature(this.ptr);
28 * The signature by the node key
30 public void set_signature(byte[] val) {
31 bindings.NodeAnnouncement_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
37 * The actual content of the announcement
39 public UnsignedNodeAnnouncement get_contents() {
40 long ret = bindings.NodeAnnouncement_get_contents(this.ptr);
42 if (ret >= 0 && ret <= 4096) { return null; }
43 org.ldk.structs.UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedNodeAnnouncement(null, ret); }
44 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
49 * The actual content of the announcement
51 public void set_contents(org.ldk.structs.UnsignedNodeAnnouncement val) {
52 bindings.NodeAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr);
55 if (this != null) { this.ptrs_to.AddLast(val); };
59 * Constructs a new NodeAnnouncement given each field
61 public static NodeAnnouncement of(byte[] signature_arg, org.ldk.structs.UnsignedNodeAnnouncement contents_arg) {
62 long ret = bindings.NodeAnnouncement_new(InternalUtils.check_arr_len(signature_arg, 64), contents_arg == null ? 0 : contents_arg.ptr);
63 GC.KeepAlive(signature_arg);
64 GC.KeepAlive(contents_arg);
65 if (ret >= 0 && ret <= 4096) { return null; }
66 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(contents_arg); };
72 internal long clone_ptr() {
73 long ret = bindings.NodeAnnouncement_clone_ptr(this.ptr);
79 * Creates a copy of the NodeAnnouncement
81 public NodeAnnouncement clone() {
82 long ret = bindings.NodeAnnouncement_clone(this.ptr);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91 * Checks if two NodeAnnouncements contain equal inner contents.
92 * This ignores pointers and is_owned flags and looks at the values in fields.
93 * Two objects with NULL inner values will be considered "equal" here.
95 public bool eq(org.ldk.structs.NodeAnnouncement b) {
96 bool ret = bindings.NodeAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
99 if (this != null) { this.ptrs_to.AddLast(b); };
103 public override bool Equals(object o) {
104 if (!(o is NodeAnnouncement)) return false;
105 return this.eq((NodeAnnouncement)o);
108 * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
110 public byte[] write() {
111 byte[] ret = bindings.NodeAnnouncement_write(this.ptr);
117 * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
119 public static Result_NodeAnnouncementDecodeErrorZ read(byte[] ser) {
120 long ret = bindings.NodeAnnouncement_read(ser);
122 if (ret >= 0 && ret <= 4096) { return null; }
123 Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);