6 namespace org { namespace ldk { namespace structs {
10 * Details about a node in the network, known from the network announcement.
12 public class NodeInfo : CommonBase {
13 internal NodeInfo(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.NodeInfo_free(ptr); }
19 * All valid channels a node has announced
21 * Returns a copy of the field.
23 public long[] get_channels() {
24 long[] ret = bindings.NodeInfo_get_channels(this.ptr);
30 * All valid channels a node has announced
32 public void set_channels(long[] val) {
33 bindings.NodeInfo_set_channels(this.ptr, val);
39 * More information about a node from node_announcement.
40 * Optional because we store a Node entry after learning about it from
41 * a channel announcement, but before receiving a node announcement.
43 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
45 public NodeAnnouncementInfo get_announcement_info() {
46 long ret = bindings.NodeInfo_get_announcement_info(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
55 * More information about a node from node_announcement.
56 * Optional because we store a Node entry after learning about it from
57 * a channel announcement, but before receiving a node announcement.
59 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
61 public void set_announcement_info(org.ldk.structs.NodeAnnouncementInfo val) {
62 bindings.NodeInfo_set_announcement_info(this.ptr, val == null ? 0 : val.ptr);
65 if (this != null) { this.ptrs_to.AddLast(val); };
69 * Constructs a new NodeInfo given each field
71 public static NodeInfo of(long[] channels_arg, org.ldk.structs.NodeAnnouncementInfo announcement_info_arg) {
72 long ret = bindings.NodeInfo_new(channels_arg, announcement_info_arg == null ? 0 : announcement_info_arg.ptr);
73 GC.KeepAlive(channels_arg);
74 GC.KeepAlive(announcement_info_arg);
75 if (ret >= 0 && ret <= 4096) { return null; }
76 org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); }
77 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
78 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(announcement_info_arg); };
82 internal long clone_ptr() {
83 long ret = bindings.NodeInfo_clone_ptr(this.ptr);
89 * Creates a copy of the NodeInfo
91 public NodeInfo clone() {
92 long ret = bindings.NodeInfo_clone(this.ptr);
94 if (ret >= 0 && ret <= 4096) { return null; }
95 org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); }
96 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
101 * Checks if two NodeInfos contain equal inner contents.
102 * This ignores pointers and is_owned flags and looks at the values in fields.
103 * Two objects with NULL inner values will be considered "equal" here.
105 public bool eq(org.ldk.structs.NodeInfo b) {
106 bool ret = bindings.NodeInfo_eq(this.ptr, b == null ? 0 : b.ptr);
109 if (this != null) { this.ptrs_to.AddLast(b); };
113 public override bool Equals(object o) {
114 if (!(o is NodeInfo)) return false;
115 return this.eq((NodeInfo)o);
118 * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
120 public byte[] write() {
121 byte[] ret = bindings.NodeInfo_write(this.ptr);
127 * Read a NodeInfo from a byte array, created by NodeInfo_write
129 public static Result_NodeInfoDecodeErrorZ read(byte[] ser) {
130 long ret = bindings.NodeInfo_read(ser);
132 if (ret >= 0 && ret <= 4096) { return null; }
133 Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret);