6 namespace org { namespace ldk { namespace structs {
10 * The unsigned part of a [`channel_update`] message.
12 * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
14 public class UnsignedChannelUpdate : CommonBase {
15 internal UnsignedChannelUpdate(object _dummy, long ptr) : base(ptr) { }
16 ~UnsignedChannelUpdate() {
17 if (ptr != 0) { bindings.UnsignedChannelUpdate_free(ptr); }
21 * The genesis hash of the blockchain where the channel is to be opened
23 public byte[] get_chain_hash() {
24 long ret = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
32 * The genesis hash of the blockchain where the channel is to be opened
34 public void set_chain_hash(byte[] val) {
35 bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
41 * The short channel ID
43 public long get_short_channel_id() {
44 long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
50 * The short channel ID
52 public void set_short_channel_id(long val) {
53 bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val);
59 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
61 public int get_timestamp() {
62 int ret = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr);
68 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
70 public void set_timestamp(int val) {
71 bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val);
79 public byte get_flags() {
80 byte ret = bindings.UnsignedChannelUpdate_get_flags(this.ptr);
88 public void set_flags(byte val) {
89 bindings.UnsignedChannelUpdate_set_flags(this.ptr, val);
95 * The number of blocks such that if:
96 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
97 * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
98 * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
99 * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
100 * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
101 * forwarding. Note that the HTLC sender is the one who originally sets this value when
102 * constructing the route.
104 public short get_cltv_expiry_delta() {
105 short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr);
111 * The number of blocks such that if:
112 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
113 * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
114 * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
115 * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
116 * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
117 * forwarding. Note that the HTLC sender is the one who originally sets this value when
118 * constructing the route.
120 public void set_cltv_expiry_delta(short val) {
121 bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val);
127 * The minimum HTLC size incoming to sender, in milli-satoshi
129 public long get_htlc_minimum_msat() {
130 long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
136 * The minimum HTLC size incoming to sender, in milli-satoshi
138 public void set_htlc_minimum_msat(long val) {
139 bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val);
145 * The maximum HTLC value incoming to sender, in milli-satoshi.
147 * This used to be optional.
149 public long get_htlc_maximum_msat() {
150 long ret = bindings.UnsignedChannelUpdate_get_htlc_maximum_msat(this.ptr);
156 * The maximum HTLC value incoming to sender, in milli-satoshi.
158 * This used to be optional.
160 public void set_htlc_maximum_msat(long val) {
161 bindings.UnsignedChannelUpdate_set_htlc_maximum_msat(this.ptr, val);
167 * The base HTLC fee charged by sender, in milli-satoshi
169 public int get_fee_base_msat() {
170 int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr);
176 * The base HTLC fee charged by sender, in milli-satoshi
178 public void set_fee_base_msat(int val) {
179 bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val);
185 * The amount to fee multiplier, in micro-satoshi
187 public int get_fee_proportional_millionths() {
188 int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr);
194 * The amount to fee multiplier, in micro-satoshi
196 public void set_fee_proportional_millionths(int val) {
197 bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val);
203 * Excess data which was signed as a part of the message which we do not (yet) understand how
206 * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
208 * Returns a copy of the field.
210 public byte[] get_excess_data() {
211 long ret = bindings.UnsignedChannelUpdate_get_excess_data(this.ptr);
213 if (ret >= 0 && ret <= 4096) { return null; }
214 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
219 * Excess data which was signed as a part of the message which we do not (yet) understand how
222 * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
224 public void set_excess_data(byte[] val) {
225 bindings.UnsignedChannelUpdate_set_excess_data(this.ptr, InternalUtils.encodeUint8Array(val));
231 * Constructs a new UnsignedChannelUpdate given each field
233 public static UnsignedChannelUpdate of(byte[] chain_hash_arg, long short_channel_id_arg, int timestamp_arg, byte flags_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, int fee_base_msat_arg, int fee_proportional_millionths_arg, byte[] excess_data_arg) {
234 long ret = bindings.UnsignedChannelUpdate_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, InternalUtils.encodeUint8Array(excess_data_arg));
235 GC.KeepAlive(chain_hash_arg);
236 GC.KeepAlive(short_channel_id_arg);
237 GC.KeepAlive(timestamp_arg);
238 GC.KeepAlive(flags_arg);
239 GC.KeepAlive(cltv_expiry_delta_arg);
240 GC.KeepAlive(htlc_minimum_msat_arg);
241 GC.KeepAlive(htlc_maximum_msat_arg);
242 GC.KeepAlive(fee_base_msat_arg);
243 GC.KeepAlive(fee_proportional_millionths_arg);
244 GC.KeepAlive(excess_data_arg);
245 if (ret >= 0 && ret <= 4096) { return null; }
246 org.ldk.structs.UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelUpdate(null, ret); }
247 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
251 internal long clone_ptr() {
252 long ret = bindings.UnsignedChannelUpdate_clone_ptr(this.ptr);
258 * Creates a copy of the UnsignedChannelUpdate
260 public UnsignedChannelUpdate clone() {
261 long ret = bindings.UnsignedChannelUpdate_clone(this.ptr);
263 if (ret >= 0 && ret <= 4096) { return null; }
264 org.ldk.structs.UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelUpdate(null, ret); }
265 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
270 * Checks if two UnsignedChannelUpdates contain equal inner contents.
271 * This ignores pointers and is_owned flags and looks at the values in fields.
272 * Two objects with NULL inner values will be considered "equal" here.
274 public bool eq(org.ldk.structs.UnsignedChannelUpdate b) {
275 bool ret = bindings.UnsignedChannelUpdate_eq(this.ptr, b == null ? 0 : b.ptr);
278 if (this != null) { this.ptrs_to.AddLast(b); };
282 public override bool Equals(object o) {
283 if (!(o is UnsignedChannelUpdate)) return false;
284 return this.eq((UnsignedChannelUpdate)o);
287 * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
289 public byte[] write() {
290 long ret = bindings.UnsignedChannelUpdate_write(this.ptr);
292 if (ret >= 0 && ret <= 4096) { return null; }
293 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
298 * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
300 public static Result_UnsignedChannelUpdateDecodeErrorZ read(byte[] ser) {
301 long ret = bindings.UnsignedChannelUpdate_read(InternalUtils.encodeUint8Array(ser));
303 if (ret >= 0 && ret <= 4096) { return null; }
304 Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret);