1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * A node_announcement message to be sent or received from a peer
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class NodeAnnouncement extends CommonBase {
14 NodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.NodeAnnouncement_free(ptr); }
22 * The signature by the node key
24 public byte[] get_signature() {
25 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, val);
37 * The actual content of the announcement
39 public UnsignedNodeAnnouncement get_contents() {
40 long ret = bindings.NodeAnnouncement_get_contents(this.ptr);
41 UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(null, ret);
42 ret_hu_conv.ptrs_to.add(this);
47 * The actual content of the announcement
49 public void set_contents(UnsignedNodeAnnouncement val) {
50 bindings.NodeAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr & ~1);
51 this.ptrs_to.add(val);
55 * Constructs a new NodeAnnouncement given each field
57 public static NodeAnnouncement constructor_new(byte[] signature_arg, UnsignedNodeAnnouncement contents_arg) {
58 long ret = bindings.NodeAnnouncement_new(signature_arg, contents_arg == null ? 0 : contents_arg.ptr & ~1);
59 NodeAnnouncement ret_hu_conv = new NodeAnnouncement(null, ret);
60 ret_hu_conv.ptrs_to.add(ret_hu_conv);
61 ret_hu_conv.ptrs_to.add(contents_arg);
66 * Creates a copy of the NodeAnnouncement
68 public NodeAnnouncement clone() {
69 long ret = bindings.NodeAnnouncement_clone(this.ptr);
70 NodeAnnouncement ret_hu_conv = new NodeAnnouncement(null, ret);
71 ret_hu_conv.ptrs_to.add(this);
76 * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
78 public byte[] write() {
79 byte[] ret = bindings.NodeAnnouncement_write(this.ptr);
84 * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
86 public static Result_NodeAnnouncementDecodeErrorZ constructor_read(byte[] ser) {
87 long ret = bindings.NodeAnnouncement_read(ser);
88 Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);