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 * Lowest fees enabling routing via any of the enabled, known channels to a node.
40 * The two fields (flat and proportional fee) are independent,
41 * meaning they don't have to refer to the same channel.
43 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
45 public RoutingFees get_lowest_inbound_channel_fees() {
46 long ret = bindings.NodeInfo_get_lowest_inbound_channel_fees(this.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
55 * Lowest fees enabling routing via any of the enabled, known channels to a node.
56 * The two fields (flat and proportional fee) are independent,
57 * meaning they don't have to refer to the same channel.
59 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
61 public void set_lowest_inbound_channel_fees(org.ldk.structs.RoutingFees val) {
62 bindings.NodeInfo_set_lowest_inbound_channel_fees(this.ptr, val == null ? 0 : val.ptr);
65 if (this != null) { this.ptrs_to.AddLast(val); };
69 * More information about a node from node_announcement.
70 * Optional because we store a Node entry after learning about it from
71 * a channel announcement, but before receiving a node announcement.
73 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
75 public NodeAnnouncementInfo get_announcement_info() {
76 long ret = bindings.NodeInfo_get_announcement_info(this.ptr);
78 if (ret >= 0 && ret <= 4096) { return null; }
79 org.ldk.structs.NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAnnouncementInfo(null, ret); }
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
85 * More information about a node from node_announcement.
86 * Optional because we store a Node entry after learning about it from
87 * a channel announcement, but before receiving a node announcement.
89 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
91 public void set_announcement_info(org.ldk.structs.NodeAnnouncementInfo val) {
92 bindings.NodeInfo_set_announcement_info(this.ptr, val == null ? 0 : val.ptr);
95 if (this != null) { this.ptrs_to.AddLast(val); };
99 * Constructs a new NodeInfo given each field
101 public static NodeInfo of(long[] channels_arg, org.ldk.structs.RoutingFees lowest_inbound_channel_fees_arg, org.ldk.structs.NodeAnnouncementInfo announcement_info_arg) {
102 long ret = bindings.NodeInfo_new(channels_arg, lowest_inbound_channel_fees_arg == null ? 0 : lowest_inbound_channel_fees_arg.ptr, announcement_info_arg == null ? 0 : announcement_info_arg.ptr);
103 GC.KeepAlive(channels_arg);
104 GC.KeepAlive(lowest_inbound_channel_fees_arg);
105 GC.KeepAlive(announcement_info_arg);
106 if (ret >= 0 && ret <= 4096) { return null; }
107 org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); }
108 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
109 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(lowest_inbound_channel_fees_arg); };
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(announcement_info_arg); };
114 internal long clone_ptr() {
115 long ret = bindings.NodeInfo_clone_ptr(this.ptr);
121 * Creates a copy of the NodeInfo
123 public NodeInfo clone() {
124 long ret = bindings.NodeInfo_clone(this.ptr);
126 if (ret >= 0 && ret <= 4096) { return null; }
127 org.ldk.structs.NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeInfo(null, ret); }
128 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
133 * Checks if two NodeInfos contain equal inner contents.
134 * This ignores pointers and is_owned flags and looks at the values in fields.
135 * Two objects with NULL inner values will be considered "equal" here.
137 public bool eq(org.ldk.structs.NodeInfo b) {
138 bool ret = bindings.NodeInfo_eq(this.ptr, b == null ? 0 : b.ptr);
141 if (this != null) { this.ptrs_to.AddLast(b); };
145 public override bool Equals(object o) {
146 if (!(o is NodeInfo)) return false;
147 return this.eq((NodeInfo)o);
150 * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
152 public byte[] write() {
153 byte[] ret = bindings.NodeInfo_write(this.ptr);
159 * Read a NodeInfo from a byte array, created by NodeInfo_write
161 public static Result_NodeInfoDecodeErrorZ read(byte[] ser) {
162 long ret = bindings.NodeInfo_read(ser);
164 if (ret >= 0 && ret <= 4096) { return null; }
165 Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret);