1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * The unsigned part of a channel_update
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class UnsignedChannelUpdate extends CommonBase {
14 UnsignedChannelUpdate(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.UnsignedChannelUpdate_free(ptr); }
22 * The genesis hash of the blockchain where the channel is to be opened
24 public byte[] get_chain_hash() {
25 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, val);
37 * The short channel ID
39 public long get_short_channel_id() {
40 long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr);
45 * The short channel ID
47 public void set_short_channel_id(long val) {
48 bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val);
52 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
54 public int get_timestamp() {
55 int ret = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr);
60 * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
62 public void set_timestamp(int val) {
63 bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val);
69 public byte get_flags() {
70 byte ret = bindings.UnsignedChannelUpdate_get_flags(this.ptr);
77 public void set_flags(byte val) {
78 bindings.UnsignedChannelUpdate_set_flags(this.ptr, val);
82 * The number of blocks such that if:
83 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
84 * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
85 * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
86 * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
87 * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
88 * forwarding. Note that the HTLC sender is the one who originally sets this value when
89 * constructing the route.
91 public short get_cltv_expiry_delta() {
92 short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr);
97 * The number of blocks such that if:
98 * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
99 * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
100 * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
101 * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
102 * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
103 * forwarding. Note that the HTLC sender is the one who originally sets this value when
104 * constructing the route.
106 public void set_cltv_expiry_delta(short val) {
107 bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val);
111 * The minimum HTLC size incoming to sender, in milli-satoshi
113 public long get_htlc_minimum_msat() {
114 long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr);
119 * The minimum HTLC size incoming to sender, in milli-satoshi
121 public void set_htlc_minimum_msat(long val) {
122 bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val);
126 * The base HTLC fee charged by sender, in milli-satoshi
128 public int get_fee_base_msat() {
129 int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr);
134 * The base HTLC fee charged by sender, in milli-satoshi
136 public void set_fee_base_msat(int val) {
137 bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val);
141 * The amount to fee multiplier, in micro-satoshi
143 public int get_fee_proportional_millionths() {
144 int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr);
149 * The amount to fee multiplier, in micro-satoshi
151 public void set_fee_proportional_millionths(int val) {
152 bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val);
156 * Creates a copy of the UnsignedChannelUpdate
158 public UnsignedChannelUpdate clone() {
159 long ret = bindings.UnsignedChannelUpdate_clone(this.ptr);
160 if (ret < 1024) { return null; }
161 UnsignedChannelUpdate ret_hu_conv = new UnsignedChannelUpdate(null, ret);
162 ret_hu_conv.ptrs_to.add(this);
167 * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
169 public byte[] write() {
170 byte[] ret = bindings.UnsignedChannelUpdate_write(this.ptr);
175 * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
177 public static Result_UnsignedChannelUpdateDecodeErrorZ read(byte[] ser) {
178 long ret = bindings.UnsignedChannelUpdate_read(ser);
179 if (ret < 1024) { return null; }
180 Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret);