6 namespace org { namespace ldk { namespace structs {
10 * Details about one direction of a channel as received within a [`ChannelUpdate`].
12 public class ChannelUpdateInfo : CommonBase {
13 internal ChannelUpdateInfo(object _dummy, long ptr) : base(ptr) { }
14 ~ChannelUpdateInfo() {
15 if (ptr != 0) { bindings.ChannelUpdateInfo_free(ptr); }
19 * When the last update to the channel direction was issued.
20 * Value is opaque, as set in the announcement.
22 public int get_last_update() {
23 int ret = bindings.ChannelUpdateInfo_get_last_update(this.ptr);
29 * When the last update to the channel direction was issued.
30 * Value is opaque, as set in the announcement.
32 public void set_last_update(int val) {
33 bindings.ChannelUpdateInfo_set_last_update(this.ptr, val);
39 * Whether the channel can be currently used for payments (in this one direction).
41 public bool get_enabled() {
42 bool ret = bindings.ChannelUpdateInfo_get_enabled(this.ptr);
48 * Whether the channel can be currently used for payments (in this one direction).
50 public void set_enabled(bool val) {
51 bindings.ChannelUpdateInfo_set_enabled(this.ptr, val);
57 * The difference in CLTV values that you must have when routing through this channel.
59 public short get_cltv_expiry_delta() {
60 short ret = bindings.ChannelUpdateInfo_get_cltv_expiry_delta(this.ptr);
66 * The difference in CLTV values that you must have when routing through this channel.
68 public void set_cltv_expiry_delta(short val) {
69 bindings.ChannelUpdateInfo_set_cltv_expiry_delta(this.ptr, val);
75 * The minimum value, which must be relayed to the next hop via the channel
77 public long get_htlc_minimum_msat() {
78 long ret = bindings.ChannelUpdateInfo_get_htlc_minimum_msat(this.ptr);
84 * The minimum value, which must be relayed to the next hop via the channel
86 public void set_htlc_minimum_msat(long val) {
87 bindings.ChannelUpdateInfo_set_htlc_minimum_msat(this.ptr, val);
93 * The maximum value which may be relayed to the next hop via the channel.
95 public long get_htlc_maximum_msat() {
96 long ret = bindings.ChannelUpdateInfo_get_htlc_maximum_msat(this.ptr);
102 * The maximum value which may be relayed to the next hop via the channel.
104 public void set_htlc_maximum_msat(long val) {
105 bindings.ChannelUpdateInfo_set_htlc_maximum_msat(this.ptr, val);
111 * Fees charged when the channel is used for routing
113 public RoutingFees get_fees() {
114 long ret = bindings.ChannelUpdateInfo_get_fees(this.ptr);
116 if (ret >= 0 && ret <= 4096) { return null; }
117 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
118 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
123 * Fees charged when the channel is used for routing
125 public void set_fees(org.ldk.structs.RoutingFees val) {
126 bindings.ChannelUpdateInfo_set_fees(this.ptr, val == null ? 0 : val.ptr);
129 if (this != null) { this.ptrs_to.AddLast(val); };
133 * Most recent update for the channel received from the network
134 * Mostly redundant with the data we store in fields explicitly.
135 * Everything else is useful only for sending out for initial routing sync.
136 * Not stored if contains excess data to prevent DoS.
138 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
140 public ChannelUpdate get_last_update_message() {
141 long ret = bindings.ChannelUpdateInfo_get_last_update_message(this.ptr);
143 if (ret >= 0 && ret <= 4096) { return null; }
144 org.ldk.structs.ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdate(null, ret); }
145 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
150 * Most recent update for the channel received from the network
151 * Mostly redundant with the data we store in fields explicitly.
152 * Everything else is useful only for sending out for initial routing sync.
153 * Not stored if contains excess data to prevent DoS.
155 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
157 public void set_last_update_message(org.ldk.structs.ChannelUpdate val) {
158 bindings.ChannelUpdateInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr);
161 if (this != null) { this.ptrs_to.AddLast(val); };
165 * Constructs a new ChannelUpdateInfo given each field
167 public static ChannelUpdateInfo of(int last_update_arg, bool enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, org.ldk.structs.RoutingFees fees_arg, org.ldk.structs.ChannelUpdate last_update_message_arg) {
168 long ret = bindings.ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg == null ? 0 : fees_arg.ptr, last_update_message_arg == null ? 0 : last_update_message_arg.ptr);
169 GC.KeepAlive(last_update_arg);
170 GC.KeepAlive(enabled_arg);
171 GC.KeepAlive(cltv_expiry_delta_arg);
172 GC.KeepAlive(htlc_minimum_msat_arg);
173 GC.KeepAlive(htlc_maximum_msat_arg);
174 GC.KeepAlive(fees_arg);
175 GC.KeepAlive(last_update_message_arg);
176 if (ret >= 0 && ret <= 4096) { return null; }
177 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
178 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
179 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fees_arg); };
180 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(last_update_message_arg); };
184 internal long clone_ptr() {
185 long ret = bindings.ChannelUpdateInfo_clone_ptr(this.ptr);
191 * Creates a copy of the ChannelUpdateInfo
193 public ChannelUpdateInfo clone() {
194 long ret = bindings.ChannelUpdateInfo_clone(this.ptr);
196 if (ret >= 0 && ret <= 4096) { return null; }
197 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
198 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
203 * Checks if two ChannelUpdateInfos contain equal inner contents.
204 * This ignores pointers and is_owned flags and looks at the values in fields.
205 * Two objects with NULL inner values will be considered "equal" here.
207 public bool eq(org.ldk.structs.ChannelUpdateInfo b) {
208 bool ret = bindings.ChannelUpdateInfo_eq(this.ptr, b == null ? 0 : b.ptr);
211 if (this != null) { this.ptrs_to.AddLast(b); };
215 public override bool Equals(object o) {
216 if (!(o is ChannelUpdateInfo)) return false;
217 return this.eq((ChannelUpdateInfo)o);
220 * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
222 public byte[] write() {
223 byte[] ret = bindings.ChannelUpdateInfo_write(this.ptr);
229 * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
231 public static Result_ChannelUpdateInfoDecodeErrorZ read(byte[] ser) {
232 long ret = bindings.ChannelUpdateInfo_read(ser);
234 if (ret >= 0 && ret <= 4096) { return null; }
235 Result_ChannelUpdateInfoDecodeErrorZ ret_hu_conv = Result_ChannelUpdateInfoDecodeErrorZ.constr_from_ptr(ret);