ce248fc3279f6150f1d855f9d59c9d0d14672e17
[ldk-java] / src / main / java / org / ldk / structs / TxIn.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 public class TxIn extends CommonBase {
11         /** The witness in this input, in serialized form */
12         public final byte[] witness;
13         /** The script_sig in this input */
14         public final byte[] script_sig;
15         /** The transaction output's sequence number */
16         public final int sequence;
17         /** The txid this input is spending */
18         public final byte[] previous_txid;
19         /** The output index within the spent transaction of the output this input is spending */
20         public final int previous_vout;
21
22         TxIn(java.lang.Object _dummy, long ptr) {
23                 super(ptr);
24                 this.witness = bindings.TxIn_get_witness(ptr);
25                 this.script_sig = bindings.TxIn_get_script_sig(ptr);
26                 this.sequence = bindings.TxIn_get_sequence(ptr);
27                 this.previous_txid = bindings.TxIn_get_previous_txid(ptr);
28                 this.previous_vout = bindings.TxIn_get_previous_vout(ptr);
29         }
30         /** Constructs a new TxIn, note that previous_txid must be exactly 32 bytes */
31         public TxIn(byte[] witness, byte[] script_sig, int sequence, byte[] previous_txid, int previous_vout) {
32                 this(null, bindings.TxIn_new(witness, script_sig, sequence, previous_txid, previous_vout));
33         }
34
35         @Override @SuppressWarnings("deprecation")
36         protected void finalize() throws Throwable {
37                 super.finalize();
38                 if (ptr != 0) { bindings.TxIn_free(ptr); }
39         }
40 }