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 * A funding_locked message to be sent or received from a peer
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class FundingLocked extends CommonBase {
16 FundingLocked(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.FundingLocked_free(ptr); }
26 public byte[] get_channel_id() {
27 byte[] ret = bindings.FundingLocked_get_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
35 public void set_channel_id(byte[] val) {
36 bindings.FundingLocked_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * The per-commitment point of the second commitment transaction
44 public byte[] get_next_per_commitment_point() {
45 byte[] ret = bindings.FundingLocked_get_next_per_commitment_point(this.ptr);
46 Reference.reachabilityFence(this);
51 * The per-commitment point of the second commitment transaction
53 public void set_next_per_commitment_point(byte[] val) {
54 bindings.FundingLocked_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
55 Reference.reachabilityFence(this);
56 Reference.reachabilityFence(val);
60 * Constructs a new FundingLocked given each field
62 public static FundingLocked of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg) {
63 long ret = bindings.FundingLocked_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33));
64 Reference.reachabilityFence(channel_id_arg);
65 Reference.reachabilityFence(next_per_commitment_point_arg);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 FundingLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingLocked(null, ret); }
68 ret_hu_conv.ptrs_to.add(ret_hu_conv);
73 long ret = bindings.FundingLocked_clone_ptr(this.ptr);
74 Reference.reachabilityFence(this);
79 * Creates a copy of the FundingLocked
81 public FundingLocked clone() {
82 long ret = bindings.FundingLocked_clone(this.ptr);
83 Reference.reachabilityFence(this);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 FundingLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingLocked(null, ret); }
86 ret_hu_conv.ptrs_to.add(this);
91 * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
93 public byte[] write() {
94 byte[] ret = bindings.FundingLocked_write(this.ptr);
95 Reference.reachabilityFence(this);
100 * Read a FundingLocked from a byte array, created by FundingLocked_write
102 public static Result_FundingLockedDecodeErrorZ read(byte[] ser) {
103 long ret = bindings.FundingLocked_read(ser);
104 Reference.reachabilityFence(ser);
105 if (ret >= 0 && ret <= 4096) { return null; }
106 Result_FundingLockedDecodeErrorZ ret_hu_conv = Result_FundingLockedDecodeErrorZ.constr_from_ptr(ret);