6 namespace org { namespace ldk { namespace structs {
10 * A [`node_announcement`] message to be sent to or received from a peer.
12 * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
14 public class NodeAnnouncement : CommonBase {
15 internal NodeAnnouncement(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.NodeAnnouncement_free(ptr); }
21 * The signature by the node key
23 public byte[] get_signature() {
24 byte[] ret = bindings.NodeAnnouncement_get_signature(this.ptr);
30 * The signature by the node key
32 public void set_signature(byte[] val) {
33 bindings.NodeAnnouncement_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
39 * The actual content of the announcement
41 public UnsignedNodeAnnouncement get_contents() {
42 long ret = bindings.NodeAnnouncement_get_contents(this.ptr);
44 if (ret >= 0 && ret <= 4096) { return null; }
45 org.ldk.structs.UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedNodeAnnouncement(null, ret); }
46 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
51 * The actual content of the announcement
53 public void set_contents(org.ldk.structs.UnsignedNodeAnnouncement val) {
54 bindings.NodeAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr);
57 if (this != null) { this.ptrs_to.AddLast(val); };
61 * Constructs a new NodeAnnouncement given each field
63 public static NodeAnnouncement of(byte[] signature_arg, org.ldk.structs.UnsignedNodeAnnouncement contents_arg) {
64 long ret = bindings.NodeAnnouncement_new(InternalUtils.check_arr_len(signature_arg, 64), contents_arg == null ? 0 : contents_arg.ptr);
65 GC.KeepAlive(signature_arg);
66 GC.KeepAlive(contents_arg);
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(contents_arg); };
74 internal long clone_ptr() {
75 long ret = bindings.NodeAnnouncement_clone_ptr(this.ptr);
81 * Creates a copy of the NodeAnnouncement
83 public NodeAnnouncement clone() {
84 long ret = bindings.NodeAnnouncement_clone(this.ptr);
86 if (ret >= 0 && ret <= 4096) { return null; }
87 org.ldk.structs.NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncement(null, ret); }
88 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
93 * Checks if two NodeAnnouncements contain equal inner contents.
94 * This ignores pointers and is_owned flags and looks at the values in fields.
95 * Two objects with NULL inner values will be considered "equal" here.
97 public bool eq(org.ldk.structs.NodeAnnouncement b) {
98 bool ret = bindings.NodeAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
101 if (this != null) { this.ptrs_to.AddLast(b); };
105 public override bool Equals(object o) {
106 if (!(o is NodeAnnouncement)) return false;
107 return this.eq((NodeAnnouncement)o);
110 * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
112 public byte[] write() {
113 byte[] ret = bindings.NodeAnnouncement_write(this.ptr);
119 * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
121 public static Result_NodeAnnouncementDecodeErrorZ read(byte[] ser) {
122 long ret = bindings.NodeAnnouncement_read(ser);
124 if (ret >= 0 && ret <= 4096) { return null; }
125 Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);