1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * The unsigned part of a channel_update
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UnsignedChannelUpdate extends CommonBase {
16 UnsignedChannelUpdate(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.UnsignedChannelUpdate_free(ptr); }
24 * The genesis hash of the blockchain where the channel is to be opened
26 public byte[] get_chain_hash() {
27 byte[] ret = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr);
28 Reference.reachabilityFence(this);
33 * The genesis hash of the blockchain where the channel is to be opened
35 public void set_chain_hash(byte[] val) {
36 bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * The short channel ID
44 public long get_short_channel_id() {
45 long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
46 Reference.reachabilityFence(this);
51 * The short channel ID
53 public void set_short_channel_id(long val) {
54 bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val);
55 Reference.reachabilityFence(this);
56 Reference.reachabilityFence(val);
60 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
62 public int get_timestamp() {
63 int ret = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr);
64 Reference.reachabilityFence(this);
69 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
71 public void set_timestamp(int val) {
72 bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val);
73 Reference.reachabilityFence(this);
74 Reference.reachabilityFence(val);
80 public byte get_flags() {
81 byte ret = bindings.UnsignedChannelUpdate_get_flags(this.ptr);
82 Reference.reachabilityFence(this);
89 public void set_flags(byte val) {
90 bindings.UnsignedChannelUpdate_set_flags(this.ptr, val);
91 Reference.reachabilityFence(this);
92 Reference.reachabilityFence(val);
96 * The number of blocks such that if:
97 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
98 * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
99 * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
100 * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
101 * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
102 * forwarding. Note that the HTLC sender is the one who originally sets this value when
103 * constructing the route.
105 public short get_cltv_expiry_delta() {
106 short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr);
107 Reference.reachabilityFence(this);
112 * The number of blocks such that if:
113 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
114 * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
115 * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
116 * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
117 * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
118 * forwarding. Note that the HTLC sender is the one who originally sets this value when
119 * constructing the route.
121 public void set_cltv_expiry_delta(short val) {
122 bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val);
123 Reference.reachabilityFence(this);
124 Reference.reachabilityFence(val);
128 * The minimum HTLC size incoming to sender, in milli-satoshi
130 public long get_htlc_minimum_msat() {
131 long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
132 Reference.reachabilityFence(this);
137 * The minimum HTLC size incoming to sender, in milli-satoshi
139 public void set_htlc_minimum_msat(long val) {
140 bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val);
141 Reference.reachabilityFence(this);
142 Reference.reachabilityFence(val);
146 * The base HTLC fee charged by sender, in milli-satoshi
148 public int get_fee_base_msat() {
149 int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr);
150 Reference.reachabilityFence(this);
155 * The base HTLC fee charged by sender, in milli-satoshi
157 public void set_fee_base_msat(int val) {
158 bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val);
159 Reference.reachabilityFence(this);
160 Reference.reachabilityFence(val);
164 * The amount to fee multiplier, in micro-satoshi
166 public int get_fee_proportional_millionths() {
167 int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr);
168 Reference.reachabilityFence(this);
173 * The amount to fee multiplier, in micro-satoshi
175 public void set_fee_proportional_millionths(int val) {
176 bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val);
177 Reference.reachabilityFence(this);
178 Reference.reachabilityFence(val);
182 long ret = bindings.UnsignedChannelUpdate_clone_ptr(this.ptr);
183 Reference.reachabilityFence(this);
188 * Creates a copy of the UnsignedChannelUpdate
190 public UnsignedChannelUpdate clone() {
191 long ret = bindings.UnsignedChannelUpdate_clone(this.ptr);
192 Reference.reachabilityFence(this);
193 if (ret >= 0 && ret <= 4096) { return null; }
194 UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelUpdate(null, ret); }
195 ret_hu_conv.ptrs_to.add(this);
200 * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
202 public byte[] write() {
203 byte[] ret = bindings.UnsignedChannelUpdate_write(this.ptr);
204 Reference.reachabilityFence(this);
209 * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
211 public static Result_UnsignedChannelUpdateDecodeErrorZ read(byte[] ser) {
212 long ret = bindings.UnsignedChannelUpdate_read(ser);
213 Reference.reachabilityFence(ser);
214 if (ret >= 0 && ret <= 4096) { return null; }
215 Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret);