6 namespace org { namespace ldk { namespace structs {
10 * Details about a channel (both directions).
11 * Received within a channel announcement.
13 public class ChannelInfo : CommonBase {
14 internal ChannelInfo(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.ChannelInfo_free(ptr); }
20 * Protocol features of a channel communicated during its announcement
22 public ChannelFeatures get_features() {
23 long ret = bindings.ChannelInfo_get_features(this.ptr);
25 if (ret >= 0 && ret <= 4096) { return null; }
26 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
27 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
32 * Protocol features of a channel communicated during its announcement
34 public void set_features(org.ldk.structs.ChannelFeatures val) {
35 bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr);
38 if (this != null) { this.ptrs_to.AddLast(val); };
42 * Source node of the first direction of a channel
44 public NodeId get_node_one() {
45 long ret = bindings.ChannelInfo_get_node_one(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
54 * Source node of the first direction of a channel
56 public void set_node_one(org.ldk.structs.NodeId val) {
57 bindings.ChannelInfo_set_node_one(this.ptr, val == null ? 0 : val.ptr);
60 if (this != null) { this.ptrs_to.AddLast(val); };
64 * Details about the first direction of a channel
66 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
68 public ChannelUpdateInfo get_one_to_two() {
69 long ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
78 * Details about the first direction of a channel
80 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
82 public void set_one_to_two(org.ldk.structs.ChannelUpdateInfo val) {
83 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr);
86 if (this != null) { this.ptrs_to.AddLast(val); };
90 * Source node of the second direction of a channel
92 public NodeId get_node_two() {
93 long ret = bindings.ChannelInfo_get_node_two(this.ptr);
95 if (ret >= 0 && ret <= 4096) { return null; }
96 org.ldk.structs.NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeId(null, ret); }
97 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
102 * Source node of the second direction of a channel
104 public void set_node_two(org.ldk.structs.NodeId val) {
105 bindings.ChannelInfo_set_node_two(this.ptr, val == null ? 0 : val.ptr);
108 if (this != null) { this.ptrs_to.AddLast(val); };
112 * Details about the second direction of a channel
114 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
116 public ChannelUpdateInfo get_two_to_one() {
117 long ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
119 if (ret >= 0 && ret <= 4096) { return null; }
120 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
121 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
126 * Details about the second direction of a channel
128 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
130 public void set_two_to_one(org.ldk.structs.ChannelUpdateInfo val) {
131 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr);
134 if (this != null) { this.ptrs_to.AddLast(val); };
138 * The channel capacity as seen on-chain, if chain lookup is available.
140 public Option_u64Z get_capacity_sats() {
141 long ret = bindings.ChannelInfo_get_capacity_sats(this.ptr);
143 if (ret >= 0 && ret <= 4096) { return null; }
144 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
145 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
150 * The channel capacity as seen on-chain, if chain lookup is available.
152 public void set_capacity_sats(org.ldk.structs.Option_u64Z val) {
153 bindings.ChannelInfo_set_capacity_sats(this.ptr, val.ptr);
159 * An initial announcement of the channel
160 * Mostly redundant with the data we store in fields explicitly.
161 * Everything else is useful only for sending out for initial routing sync.
162 * Not stored if contains excess data to prevent DoS.
164 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
166 public ChannelAnnouncement get_announcement_message() {
167 long ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
169 if (ret >= 0 && ret <= 4096) { return null; }
170 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
171 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
176 * An initial announcement of the channel
177 * Mostly redundant with the data we store in fields explicitly.
178 * Everything else is useful only for sending out for initial routing sync.
179 * Not stored if contains excess data to prevent DoS.
181 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
183 public void set_announcement_message(org.ldk.structs.ChannelAnnouncement val) {
184 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr);
187 if (this != null) { this.ptrs_to.AddLast(val); };
190 internal long clone_ptr() {
191 long ret = bindings.ChannelInfo_clone_ptr(this.ptr);
197 * Creates a copy of the ChannelInfo
199 public ChannelInfo clone() {
200 long ret = bindings.ChannelInfo_clone(this.ptr);
202 if (ret >= 0 && ret <= 4096) { return null; }
203 org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); }
204 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
209 * Checks if two ChannelInfos contain equal inner contents.
210 * This ignores pointers and is_owned flags and looks at the values in fields.
211 * Two objects with NULL inner values will be considered "equal" here.
213 public bool eq(org.ldk.structs.ChannelInfo b) {
214 bool ret = bindings.ChannelInfo_eq(this.ptr, b == null ? 0 : b.ptr);
217 if (this != null) { this.ptrs_to.AddLast(b); };
221 public override bool Equals(object o) {
222 if (!(o is ChannelInfo)) return false;
223 return this.eq((ChannelInfo)o);
226 * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
228 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
230 public ChannelUpdateInfo get_directional_info(byte channel_flags) {
231 long ret = bindings.ChannelInfo_get_directional_info(this.ptr, channel_flags);
233 GC.KeepAlive(channel_flags);
234 if (ret >= 0 && ret <= 4096) { return null; }
235 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
236 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
241 * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
243 public byte[] write() {
244 byte[] ret = bindings.ChannelInfo_write(this.ptr);
250 * Read a ChannelInfo from a byte array, created by ChannelInfo_write
252 public static Result_ChannelInfoDecodeErrorZ read(byte[] ser) {
253 long ret = bindings.ChannelInfo_read(ser);
255 if (ret >= 0 && ret <= 4096) { return null; }
256 Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret);