[C#] Run tests against release library in determinism CI run
[ldk-java] / src / main / java / org / ldk / structs / TxSignatures.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * A tx_signatures message containing the sender's signatures for a transaction constructed with
13  * interactive transaction construction.
14  */
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 {
20                 super.finalize();
21                 if (ptr != 0) { bindings.TxSignatures_free(ptr); }
22         }
23
24         /**
25          * The channel ID
26          */
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); };
33                 return ret_hu_conv;
34         }
35
36         /**
37          * The channel ID
38          */
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); };
44         }
45
46         /**
47          * The TXID
48          */
49         public byte[] get_tx_hash() {
50                 byte[] ret = bindings.TxSignatures_get_tx_hash(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * The TXID
57          */
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);
62         }
63
64         /**
65          * The list of witnesses
66          * 
67          * Returns a copy of the field.
68          */
69         public byte[][] get_witnesses() {
70                 byte[][] ret = bindings.TxSignatures_get_witnesses(this.ptr);
71                 Reference.reachabilityFence(this);
72                 return ret;
73         }
74
75         /**
76          * The list of witnesses
77          */
78         public void set_witnesses(byte[][] val) {
79                 bindings.TxSignatures_set_witnesses(this.ptr, val);
80                 Reference.reachabilityFence(this);
81                 Reference.reachabilityFence(val);
82         }
83
84         /**
85          * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
86          */
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); };
93                 return ret_hu_conv;
94         }
95
96         /**
97          * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
98          */
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); };
104         }
105
106         /**
107          * Constructs a new TxSignatures given each field
108          */
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); };
120                 return ret_hu_conv;
121         }
122
123         long clone_ptr() {
124                 long ret = bindings.TxSignatures_clone_ptr(this.ptr);
125                 Reference.reachabilityFence(this);
126                 return ret;
127         }
128
129         /**
130          * Creates a copy of the TxSignatures
131          */
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); };
138                 return ret_hu_conv;
139         }
140
141         /**
142          * Generates a non-cryptographic 64-bit hash of the TxSignatures.
143          */
144         public long hash() {
145                 long ret = bindings.TxSignatures_hash(this.ptr);
146                 Reference.reachabilityFence(this);
147                 return ret;
148         }
149
150         @Override public int hashCode() {
151                 return (int)this.hash();
152         }
153         /**
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.
157          */
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); };
163                 return ret;
164         }
165
166         @Override public boolean equals(Object o) {
167                 if (!(o instanceof TxSignatures)) return false;
168                 return this.eq((TxSignatures)o);
169         }
170         /**
171          * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
172          */
173         public byte[] write() {
174                 byte[] ret = bindings.TxSignatures_write(this.ptr);
175                 Reference.reachabilityFence(this);
176                 return ret;
177         }
178
179         /**
180          * Read a TxSignatures from a byte array, created by TxSignatures_write
181          */
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);
187                 return ret_hu_conv;
188         }
189
190 }