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 byte[] ret = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr);
30 * The genesis hash of the blockchain where the channel is to be opened
32 public void set_chain_hash(byte[] val) {
33 bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * The short channel ID
41 public long get_short_channel_id() {
42 long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
48 * The short channel ID
50 public void set_short_channel_id(long val) {
51 bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val);
57 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
59 public int get_timestamp() {
60 int ret = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr);
66 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
68 public void set_timestamp(int val) {
69 bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val);
77 public byte get_flags() {
78 byte ret = bindings.UnsignedChannelUpdate_get_flags(this.ptr);
86 public void set_flags(byte val) {
87 bindings.UnsignedChannelUpdate_set_flags(this.ptr, val);
93 * The number of blocks such that if:
94 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
95 * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
96 * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
97 * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
98 * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
99 * forwarding. Note that the HTLC sender is the one who originally sets this value when
100 * constructing the route.
102 public short get_cltv_expiry_delta() {
103 short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr);
109 * The number of blocks such that if:
110 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
111 * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
112 * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
113 * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
114 * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
115 * forwarding. Note that the HTLC sender is the one who originally sets this value when
116 * constructing the route.
118 public void set_cltv_expiry_delta(short val) {
119 bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val);
125 * The minimum HTLC size incoming to sender, in milli-satoshi
127 public long get_htlc_minimum_msat() {
128 long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
134 * The minimum HTLC size incoming to sender, in milli-satoshi
136 public void set_htlc_minimum_msat(long val) {
137 bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val);
143 * The maximum HTLC value incoming to sender, in milli-satoshi.
145 * This used to be optional.
147 public long get_htlc_maximum_msat() {
148 long ret = bindings.UnsignedChannelUpdate_get_htlc_maximum_msat(this.ptr);
154 * The maximum HTLC value incoming to sender, in milli-satoshi.
156 * This used to be optional.
158 public void set_htlc_maximum_msat(long val) {
159 bindings.UnsignedChannelUpdate_set_htlc_maximum_msat(this.ptr, val);
165 * The base HTLC fee charged by sender, in milli-satoshi
167 public int get_fee_base_msat() {
168 int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr);
174 * The base HTLC fee charged by sender, in milli-satoshi
176 public void set_fee_base_msat(int val) {
177 bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val);
183 * The amount to fee multiplier, in micro-satoshi
185 public int get_fee_proportional_millionths() {
186 int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr);
192 * The amount to fee multiplier, in micro-satoshi
194 public void set_fee_proportional_millionths(int val) {
195 bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val);
201 * Excess data which was signed as a part of the message which we do not (yet) understand how
204 * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
206 * Returns a copy of the field.
208 public byte[] get_excess_data() {
209 byte[] ret = bindings.UnsignedChannelUpdate_get_excess_data(this.ptr);
215 * Excess data which was signed as a part of the message which we do not (yet) understand how
218 * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
220 public void set_excess_data(byte[] val) {
221 bindings.UnsignedChannelUpdate_set_excess_data(this.ptr, val);
227 * Constructs a new UnsignedChannelUpdate given each field
229 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) {
230 long ret = bindings.UnsignedChannelUpdate_new(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, excess_data_arg);
231 GC.KeepAlive(chain_hash_arg);
232 GC.KeepAlive(short_channel_id_arg);
233 GC.KeepAlive(timestamp_arg);
234 GC.KeepAlive(flags_arg);
235 GC.KeepAlive(cltv_expiry_delta_arg);
236 GC.KeepAlive(htlc_minimum_msat_arg);
237 GC.KeepAlive(htlc_maximum_msat_arg);
238 GC.KeepAlive(fee_base_msat_arg);
239 GC.KeepAlive(fee_proportional_millionths_arg);
240 GC.KeepAlive(excess_data_arg);
241 if (ret >= 0 && ret <= 4096) { return null; }
242 org.ldk.structs.UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelUpdate(null, ret); }
243 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
247 internal long clone_ptr() {
248 long ret = bindings.UnsignedChannelUpdate_clone_ptr(this.ptr);
254 * Creates a copy of the UnsignedChannelUpdate
256 public UnsignedChannelUpdate clone() {
257 long ret = bindings.UnsignedChannelUpdate_clone(this.ptr);
259 if (ret >= 0 && ret <= 4096) { return null; }
260 org.ldk.structs.UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedChannelUpdate(null, ret); }
261 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
266 * Checks if two UnsignedChannelUpdates contain equal inner contents.
267 * This ignores pointers and is_owned flags and looks at the values in fields.
268 * Two objects with NULL inner values will be considered "equal" here.
270 public bool eq(org.ldk.structs.UnsignedChannelUpdate b) {
271 bool ret = bindings.UnsignedChannelUpdate_eq(this.ptr, b == null ? 0 : b.ptr);
274 if (this != null) { this.ptrs_to.AddLast(b); };
278 public override bool Equals(object o) {
279 if (!(o is UnsignedChannelUpdate)) return false;
280 return this.eq((UnsignedChannelUpdate)o);
283 * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
285 public byte[] write() {
286 byte[] ret = bindings.UnsignedChannelUpdate_write(this.ptr);
292 * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
294 public static Result_UnsignedChannelUpdateDecodeErrorZ read(byte[] ser) {
295 long ret = bindings.UnsignedChannelUpdate_read(ser);
297 if (ret >= 0 && ret <= 4096) { return null; }
298 Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret);