1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * The unsigned part of a channel_update
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class UnsignedChannelUpdate extends CommonBase {
15 UnsignedChannelUpdate(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.UnsignedChannelUpdate_free(ptr); }
23 * The genesis hash of the blockchain where the channel is to be opened
25 public byte[] get_chain_hash() {
26 byte[] ret = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr);
31 * The genesis hash of the blockchain where the channel is to be opened
33 public void set_chain_hash(byte[] val) {
34 bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, val);
38 * The short channel ID
40 public long get_short_channel_id() {
41 long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
46 * The short channel ID
48 public void set_short_channel_id(long val) {
49 bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val);
53 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
55 public int get_timestamp() {
56 int ret = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr);
61 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
63 public void set_timestamp(int val) {
64 bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val);
70 public byte get_flags() {
71 byte ret = bindings.UnsignedChannelUpdate_get_flags(this.ptr);
78 public void set_flags(byte val) {
79 bindings.UnsignedChannelUpdate_set_flags(this.ptr, val);
83 * The number of blocks such that if:
84 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
85 * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
86 * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
87 * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
88 * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
89 * forwarding. Note that the HTLC sender is the one who originally sets this value when
90 * constructing the route.
92 public short get_cltv_expiry_delta() {
93 short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr);
98 * The number of blocks such that if:
99 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
100 * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
101 * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
102 * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
103 * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
104 * forwarding. Note that the HTLC sender is the one who originally sets this value when
105 * constructing the route.
107 public void set_cltv_expiry_delta(short val) {
108 bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val);
112 * The minimum HTLC size incoming to sender, in milli-satoshi
114 public long get_htlc_minimum_msat() {
115 long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
120 * The minimum HTLC size incoming to sender, in milli-satoshi
122 public void set_htlc_minimum_msat(long val) {
123 bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val);
127 * The base HTLC fee charged by sender, in milli-satoshi
129 public int get_fee_base_msat() {
130 int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr);
135 * The base HTLC fee charged by sender, in milli-satoshi
137 public void set_fee_base_msat(int val) {
138 bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val);
142 * The amount to fee multiplier, in micro-satoshi
144 public int get_fee_proportional_millionths() {
145 int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr);
150 * The amount to fee multiplier, in micro-satoshi
152 public void set_fee_proportional_millionths(int val) {
153 bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val);
157 * Creates a copy of the UnsignedChannelUpdate
159 public UnsignedChannelUpdate clone() {
160 long ret = bindings.UnsignedChannelUpdate_clone(this.ptr);
161 if (ret < 1024) { return null; }
162 UnsignedChannelUpdate ret_hu_conv = new UnsignedChannelUpdate(null, ret);
163 ret_hu_conv.ptrs_to.add(this);
168 * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
170 public byte[] write() {
171 byte[] ret = bindings.UnsignedChannelUpdate_write(this.ptr);
176 * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
178 public static Result_UnsignedChannelUpdateDecodeErrorZ read(byte[] ser) {
179 long ret = bindings.UnsignedChannelUpdate_read(ser);
180 if (ret < 1024) { return null; }
181 Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret);