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 * An accept_channel message to be sent or received from a peer
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class AcceptChannel extends CommonBase {
16 AcceptChannel(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.AcceptChannel_free(ptr); }
24 * A temporary channel ID, until the funding outpoint is announced
26 public byte[] get_temporary_channel_id() {
27 byte[] ret = bindings.AcceptChannel_get_temporary_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
33 * A temporary channel ID, until the funding outpoint is announced
35 public void set_temporary_channel_id(byte[] val) {
36 bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * The threshold below which outputs on transactions broadcast by sender will be omitted
44 public long get_dust_limit_satoshis() {
45 long ret = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr);
46 Reference.reachabilityFence(this);
51 * The threshold below which outputs on transactions broadcast by sender will be omitted
53 public void set_dust_limit_satoshis(long val) {
54 bindings.AcceptChannel_set_dust_limit_satoshis(this.ptr, val);
55 Reference.reachabilityFence(this);
56 Reference.reachabilityFence(val);
60 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
62 public long get_max_htlc_value_in_flight_msat() {
63 long ret = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr);
64 Reference.reachabilityFence(this);
69 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
71 public void set_max_htlc_value_in_flight_msat(long val) {
72 bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
73 Reference.reachabilityFence(this);
74 Reference.reachabilityFence(val);
78 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
80 public long get_channel_reserve_satoshis() {
81 long ret = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr);
82 Reference.reachabilityFence(this);
87 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
89 public void set_channel_reserve_satoshis(long val) {
90 bindings.AcceptChannel_set_channel_reserve_satoshis(this.ptr, val);
91 Reference.reachabilityFence(this);
92 Reference.reachabilityFence(val);
96 * The minimum HTLC size incoming to sender, in milli-satoshi
98 public long get_htlc_minimum_msat() {
99 long ret = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr);
100 Reference.reachabilityFence(this);
105 * The minimum HTLC size incoming to sender, in milli-satoshi
107 public void set_htlc_minimum_msat(long val) {
108 bindings.AcceptChannel_set_htlc_minimum_msat(this.ptr, val);
109 Reference.reachabilityFence(this);
110 Reference.reachabilityFence(val);
114 * Minimum depth of the funding transaction before the channel is considered open
116 public int get_minimum_depth() {
117 int ret = bindings.AcceptChannel_get_minimum_depth(this.ptr);
118 Reference.reachabilityFence(this);
123 * Minimum depth of the funding transaction before the channel is considered open
125 public void set_minimum_depth(int val) {
126 bindings.AcceptChannel_set_minimum_depth(this.ptr, val);
127 Reference.reachabilityFence(this);
128 Reference.reachabilityFence(val);
132 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
134 public short get_to_self_delay() {
135 short ret = bindings.AcceptChannel_get_to_self_delay(this.ptr);
136 Reference.reachabilityFence(this);
141 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
143 public void set_to_self_delay(short val) {
144 bindings.AcceptChannel_set_to_self_delay(this.ptr, val);
145 Reference.reachabilityFence(this);
146 Reference.reachabilityFence(val);
150 * The maximum number of inbound HTLCs towards sender
152 public short get_max_accepted_htlcs() {
153 short ret = bindings.AcceptChannel_get_max_accepted_htlcs(this.ptr);
154 Reference.reachabilityFence(this);
159 * The maximum number of inbound HTLCs towards sender
161 public void set_max_accepted_htlcs(short val) {
162 bindings.AcceptChannel_set_max_accepted_htlcs(this.ptr, val);
163 Reference.reachabilityFence(this);
164 Reference.reachabilityFence(val);
168 * The sender's key controlling the funding transaction
170 public byte[] get_funding_pubkey() {
171 byte[] ret = bindings.AcceptChannel_get_funding_pubkey(this.ptr);
172 Reference.reachabilityFence(this);
177 * The sender's key controlling the funding transaction
179 public void set_funding_pubkey(byte[] val) {
180 bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
181 Reference.reachabilityFence(this);
182 Reference.reachabilityFence(val);
186 * Used to derive a revocation key for transactions broadcast by counterparty
188 public byte[] get_revocation_basepoint() {
189 byte[] ret = bindings.AcceptChannel_get_revocation_basepoint(this.ptr);
190 Reference.reachabilityFence(this);
195 * Used to derive a revocation key for transactions broadcast by counterparty
197 public void set_revocation_basepoint(byte[] val) {
198 bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
199 Reference.reachabilityFence(this);
200 Reference.reachabilityFence(val);
204 * A payment key to sender for transactions broadcast by counterparty
206 public byte[] get_payment_point() {
207 byte[] ret = bindings.AcceptChannel_get_payment_point(this.ptr);
208 Reference.reachabilityFence(this);
213 * A payment key to sender for transactions broadcast by counterparty
215 public void set_payment_point(byte[] val) {
216 bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
217 Reference.reachabilityFence(this);
218 Reference.reachabilityFence(val);
222 * Used to derive a payment key to sender for transactions broadcast by sender
224 public byte[] get_delayed_payment_basepoint() {
225 byte[] ret = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr);
226 Reference.reachabilityFence(this);
231 * Used to derive a payment key to sender for transactions broadcast by sender
233 public void set_delayed_payment_basepoint(byte[] val) {
234 bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
235 Reference.reachabilityFence(this);
236 Reference.reachabilityFence(val);
240 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
242 public byte[] get_htlc_basepoint() {
243 byte[] ret = bindings.AcceptChannel_get_htlc_basepoint(this.ptr);
244 Reference.reachabilityFence(this);
249 * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
251 public void set_htlc_basepoint(byte[] val) {
252 bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
253 Reference.reachabilityFence(this);
254 Reference.reachabilityFence(val);
258 * The first to-be-broadcast-by-sender transaction's per commitment point
260 public byte[] get_first_per_commitment_point() {
261 byte[] ret = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr);
262 Reference.reachabilityFence(this);
267 * The first to-be-broadcast-by-sender transaction's per commitment point
269 public void set_first_per_commitment_point(byte[] val) {
270 bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
271 Reference.reachabilityFence(this);
272 Reference.reachabilityFence(val);
276 * The channel type that this channel will represent. If none is set, we derive the channel
277 * type from the intersection of our feature bits with our counterparty's feature bits from
280 * This is required to match the equivalent field in [`OpenChannel::channel_type`].
282 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
285 public ChannelTypeFeatures get_channel_type() {
286 long ret = bindings.AcceptChannel_get_channel_type(this.ptr);
287 Reference.reachabilityFence(this);
288 if (ret >= 0 && ret <= 4096) { return null; }
289 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
290 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
295 * The channel type that this channel will represent. If none is set, we derive the channel
296 * type from the intersection of our feature bits with our counterparty's feature bits from
299 * This is required to match the equivalent field in [`OpenChannel::channel_type`].
301 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
303 public void set_channel_type(@Nullable ChannelTypeFeatures val) {
304 bindings.AcceptChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
305 Reference.reachabilityFence(this);
306 Reference.reachabilityFence(val);
307 if (this != null) { this.ptrs_to.add(val); };
311 long ret = bindings.AcceptChannel_clone_ptr(this.ptr);
312 Reference.reachabilityFence(this);
317 * Creates a copy of the AcceptChannel
319 public AcceptChannel clone() {
320 long ret = bindings.AcceptChannel_clone(this.ptr);
321 Reference.reachabilityFence(this);
322 if (ret >= 0 && ret <= 4096) { return null; }
323 org.ldk.structs.AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannel(null, ret); }
324 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
329 * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
331 public byte[] write() {
332 byte[] ret = bindings.AcceptChannel_write(this.ptr);
333 Reference.reachabilityFence(this);
338 * Read a AcceptChannel from a byte array, created by AcceptChannel_write
340 public static Result_AcceptChannelDecodeErrorZ read(byte[] ser) {
341 long ret = bindings.AcceptChannel_read(ser);
342 Reference.reachabilityFence(ser);
343 if (ret >= 0 && ret <= 4096) { return null; }
344 Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret);