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 tx_signatures message containing the sender's signatures for a transaction constructed with
13 * interactive transaction construction.
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxSignatures extends CommonBase {
17 TxSignatures(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.TxSignatures_free(ptr); }
27 public byte[] get_channel_id() {
28 byte[] ret = bindings.TxSignatures_get_channel_id(this.ptr);
29 Reference.reachabilityFence(this);
36 public void set_channel_id(byte[] val) {
37 bindings.TxSignatures_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
38 Reference.reachabilityFence(this);
39 Reference.reachabilityFence(val);
45 public byte[] get_tx_hash() {
46 byte[] ret = bindings.TxSignatures_get_tx_hash(this.ptr);
47 Reference.reachabilityFence(this);
54 public void set_tx_hash(byte[] val) {
55 bindings.TxSignatures_set_tx_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
56 Reference.reachabilityFence(this);
57 Reference.reachabilityFence(val);
61 * The list of witnesses
63 * Returns a copy of the field.
65 public byte[][] get_witnesses() {
66 byte[][] ret = bindings.TxSignatures_get_witnesses(this.ptr);
67 Reference.reachabilityFence(this);
72 * The list of witnesses
74 public void set_witnesses(byte[][] val) {
75 bindings.TxSignatures_set_witnesses(this.ptr, val);
76 Reference.reachabilityFence(this);
77 Reference.reachabilityFence(val);
81 * Constructs a new TxSignatures given each field
83 public static TxSignatures of(byte[] channel_id_arg, byte[] tx_hash_arg, byte[][] witnesses_arg) {
84 long ret = bindings.TxSignatures_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(tx_hash_arg, 32), witnesses_arg);
85 Reference.reachabilityFence(channel_id_arg);
86 Reference.reachabilityFence(tx_hash_arg);
87 Reference.reachabilityFence(witnesses_arg);
88 if (ret >= 0 && ret <= 4096) { return null; }
89 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
90 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
95 long ret = bindings.TxSignatures_clone_ptr(this.ptr);
96 Reference.reachabilityFence(this);
101 * Creates a copy of the TxSignatures
103 public TxSignatures clone() {
104 long ret = bindings.TxSignatures_clone(this.ptr);
105 Reference.reachabilityFence(this);
106 if (ret >= 0 && ret <= 4096) { return null; }
107 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
108 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
113 * Generates a non-cryptographic 64-bit hash of the TxSignatures.
116 long ret = bindings.TxSignatures_hash(this.ptr);
117 Reference.reachabilityFence(this);
121 @Override public int hashCode() {
122 return (int)this.hash();
125 * Checks if two TxSignaturess contain equal inner contents.
126 * This ignores pointers and is_owned flags and looks at the values in fields.
127 * Two objects with NULL inner values will be considered "equal" here.
129 public boolean eq(org.ldk.structs.TxSignatures b) {
130 boolean ret = bindings.TxSignatures_eq(this.ptr, b == null ? 0 : b.ptr);
131 Reference.reachabilityFence(this);
132 Reference.reachabilityFence(b);
133 if (this != null) { this.ptrs_to.add(b); };
137 @Override public boolean equals(Object o) {
138 if (!(o instanceof TxSignatures)) return false;
139 return this.eq((TxSignatures)o);
142 * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
144 public byte[] write() {
145 byte[] ret = bindings.TxSignatures_write(this.ptr);
146 Reference.reachabilityFence(this);
151 * Read a TxSignatures from a byte array, created by TxSignatures_write
153 public static Result_TxSignaturesDecodeErrorZ read(byte[] ser) {
154 long ret = bindings.TxSignatures_read(ser);
155 Reference.reachabilityFence(ser);
156 if (ret >= 0 && ret <= 4096) { return null; }
157 Result_TxSignaturesDecodeErrorZ ret_hu_conv = Result_TxSignaturesDecodeErrorZ.constr_from_ptr(ret);