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);
156 if (this != null) { this.ptrs_to.AddLast(val); };
160 * An initial announcement of the channel
161 * Mostly redundant with the data we store in fields explicitly.
162 * Everything else is useful only for sending out for initial routing sync.
163 * Not stored if contains excess data to prevent DoS.
165 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
167 public ChannelAnnouncement get_announcement_message() {
168 long ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
170 if (ret >= 0 && ret <= 4096) { return null; }
171 org.ldk.structs.ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelAnnouncement(null, ret); }
172 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
177 * An initial announcement of the channel
178 * Mostly redundant with the data we store in fields explicitly.
179 * Everything else is useful only for sending out for initial routing sync.
180 * Not stored if contains excess data to prevent DoS.
182 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
184 public void set_announcement_message(org.ldk.structs.ChannelAnnouncement val) {
185 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr);
188 if (this != null) { this.ptrs_to.AddLast(val); };
191 internal long clone_ptr() {
192 long ret = bindings.ChannelInfo_clone_ptr(this.ptr);
198 * Creates a copy of the ChannelInfo
200 public ChannelInfo clone() {
201 long ret = bindings.ChannelInfo_clone(this.ptr);
203 if (ret >= 0 && ret <= 4096) { return null; }
204 org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); }
205 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
210 * Checks if two ChannelInfos contain equal inner contents.
211 * This ignores pointers and is_owned flags and looks at the values in fields.
212 * Two objects with NULL inner values will be considered "equal" here.
214 public bool eq(org.ldk.structs.ChannelInfo b) {
215 bool ret = bindings.ChannelInfo_eq(this.ptr, b == null ? 0 : b.ptr);
218 if (this != null) { this.ptrs_to.AddLast(b); };
222 public override bool Equals(object o) {
223 if (!(o is ChannelInfo)) return false;
224 return this.eq((ChannelInfo)o);
227 * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
229 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
231 public ChannelUpdateInfo get_directional_info(byte channel_flags) {
232 long ret = bindings.ChannelInfo_get_directional_info(this.ptr, channel_flags);
234 GC.KeepAlive(channel_flags);
235 if (ret >= 0 && ret <= 4096) { return null; }
236 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
237 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
242 * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
244 public byte[] write() {
245 byte[] ret = bindings.ChannelInfo_write(this.ptr);
251 * Read a ChannelInfo from a byte array, created by ChannelInfo_write
253 public static Result_ChannelInfoDecodeErrorZ read(byte[] ser) {
254 long ret = bindings.ChannelInfo_read(ser);
256 if (ret >= 0 && ret <= 4096) { return null; }
257 Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret);