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 * A commitment_signed message to be sent or received from a peer
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class CommitmentSigned extends CommonBase {
15 CommitmentSigned(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.CommitmentSigned_free(ptr); }
25 public byte[] get_channel_id() {
26 byte[] ret = bindings.CommitmentSigned_get_channel_id(this.ptr);
33 public void set_channel_id(byte[] val) {
34 bindings.CommitmentSigned_set_channel_id(this.ptr, val);
38 * A signature on the commitment transaction
40 public byte[] get_signature() {
41 byte[] ret = bindings.CommitmentSigned_get_signature(this.ptr);
46 * A signature on the commitment transaction
48 public void set_signature(byte[] val) {
49 bindings.CommitmentSigned_set_signature(this.ptr, val);
53 * Signatures on the HTLC transactions
55 public void set_htlc_signatures(byte[][] val) {
56 bindings.CommitmentSigned_set_htlc_signatures(this.ptr, val);
60 * Constructs a new CommitmentSigned given each field
62 public static CommitmentSigned of(byte[] channel_id_arg, byte[] signature_arg, byte[][] htlc_signatures_arg) {
63 long ret = bindings.CommitmentSigned_new(channel_id_arg, signature_arg, htlc_signatures_arg);
64 if (ret < 1024) { return null; }
65 CommitmentSigned ret_hu_conv = new CommitmentSigned(null, ret);
66 ret_hu_conv.ptrs_to.add(ret_hu_conv);
71 * Creates a copy of the CommitmentSigned
73 public CommitmentSigned clone() {
74 long ret = bindings.CommitmentSigned_clone(this.ptr);
75 if (ret < 1024) { return null; }
76 CommitmentSigned ret_hu_conv = new CommitmentSigned(null, ret);
77 ret_hu_conv.ptrs_to.add(this);
82 * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
84 public byte[] write() {
85 byte[] ret = bindings.CommitmentSigned_write(this.ptr);
90 * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
92 public static Result_CommitmentSignedDecodeErrorZ read(byte[] ser) {
93 long ret = bindings.CommitmentSigned_read(ser);
94 if (ret < 1024) { return null; }
95 Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret);