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 ChannelId get_channel_id() {
28 long ret = bindings.TxSignatures_get_channel_id(this.ptr);
29 Reference.reachabilityFence(this);
30 if (ret >= 0 && ret <= 4096) { return null; }
31 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
32 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
39 public void set_channel_id(org.ldk.structs.ChannelId val) {
40 bindings.TxSignatures_set_channel_id(this.ptr, val.ptr);
41 Reference.reachabilityFence(this);
42 Reference.reachabilityFence(val);
43 if (this != null) { this.ptrs_to.add(val); };
49 public byte[] get_tx_hash() {
50 byte[] ret = bindings.TxSignatures_get_tx_hash(this.ptr);
51 Reference.reachabilityFence(this);
58 public void set_tx_hash(byte[] val) {
59 bindings.TxSignatures_set_tx_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
60 Reference.reachabilityFence(this);
61 Reference.reachabilityFence(val);
65 * The list of witnesses
67 * Returns a copy of the field.
69 public byte[][] get_witnesses() {
70 byte[][] ret = bindings.TxSignatures_get_witnesses(this.ptr);
71 Reference.reachabilityFence(this);
76 * The list of witnesses
78 public void set_witnesses(byte[][] val) {
79 bindings.TxSignatures_set_witnesses(this.ptr, val);
80 Reference.reachabilityFence(this);
81 Reference.reachabilityFence(val);
85 * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
87 public Option_ECDSASignatureZ get_funding_outpoint_sig() {
88 long ret = bindings.TxSignatures_get_funding_outpoint_sig(this.ptr);
89 Reference.reachabilityFence(this);
90 if (ret >= 0 && ret <= 4096) { return null; }
91 org.ldk.structs.Option_ECDSASignatureZ ret_hu_conv = org.ldk.structs.Option_ECDSASignatureZ.constr_from_ptr(ret);
92 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
97 * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
99 public void set_funding_outpoint_sig(org.ldk.structs.Option_ECDSASignatureZ val) {
100 bindings.TxSignatures_set_funding_outpoint_sig(this.ptr, val.ptr);
101 Reference.reachabilityFence(this);
102 Reference.reachabilityFence(val);
103 if (this != null) { this.ptrs_to.add(val); };
107 * Constructs a new TxSignatures given each field
109 public static TxSignatures of(org.ldk.structs.ChannelId channel_id_arg, byte[] tx_hash_arg, byte[][] witnesses_arg, org.ldk.structs.Option_ECDSASignatureZ funding_outpoint_sig_arg) {
110 long ret = bindings.TxSignatures_new(channel_id_arg.ptr, InternalUtils.check_arr_len(tx_hash_arg, 32), witnesses_arg, funding_outpoint_sig_arg.ptr);
111 Reference.reachabilityFence(channel_id_arg);
112 Reference.reachabilityFence(tx_hash_arg);
113 Reference.reachabilityFence(witnesses_arg);
114 Reference.reachabilityFence(funding_outpoint_sig_arg);
115 if (ret >= 0 && ret <= 4096) { return null; }
116 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
117 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
118 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
119 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_outpoint_sig_arg); };
124 long ret = bindings.TxSignatures_clone_ptr(this.ptr);
125 Reference.reachabilityFence(this);
130 * Creates a copy of the TxSignatures
132 public TxSignatures clone() {
133 long ret = bindings.TxSignatures_clone(this.ptr);
134 Reference.reachabilityFence(this);
135 if (ret >= 0 && ret <= 4096) { return null; }
136 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
137 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
142 * Generates a non-cryptographic 64-bit hash of the TxSignatures.
145 long ret = bindings.TxSignatures_hash(this.ptr);
146 Reference.reachabilityFence(this);
150 @Override public int hashCode() {
151 return (int)this.hash();
154 * Checks if two TxSignaturess contain equal inner contents.
155 * This ignores pointers and is_owned flags and looks at the values in fields.
156 * Two objects with NULL inner values will be considered "equal" here.
158 public boolean eq(org.ldk.structs.TxSignatures b) {
159 boolean ret = bindings.TxSignatures_eq(this.ptr, b.ptr);
160 Reference.reachabilityFence(this);
161 Reference.reachabilityFence(b);
162 if (this != null) { this.ptrs_to.add(b); };
166 @Override public boolean equals(Object o) {
167 if (!(o instanceof TxSignatures)) return false;
168 return this.eq((TxSignatures)o);
171 * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
173 public byte[] write() {
174 byte[] ret = bindings.TxSignatures_write(this.ptr);
175 Reference.reachabilityFence(this);
180 * Read a TxSignatures from a byte array, created by TxSignatures_write
182 public static Result_TxSignaturesDecodeErrorZ read(byte[] ser) {
183 long ret = bindings.TxSignatures_read(ser);
184 Reference.reachabilityFence(ser);
185 if (ret >= 0 && ret <= 4096) { return null; }
186 Result_TxSignaturesDecodeErrorZ ret_hu_conv = Result_TxSignaturesDecodeErrorZ.constr_from_ptr(ret);