Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / TrustedClosingTransaction.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 wrapper on ClosingTransaction indicating that the built bitcoin
13  * transaction is trusted.
14  * 
15  * See trust() and verify() functions on CommitmentTransaction.
16  * 
17  * This structure implements Deref.
18  */
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class TrustedClosingTransaction extends CommonBase {
21         TrustedClosingTransaction(Object _dummy, long ptr) { super(ptr); }
22         @Override @SuppressWarnings("deprecation")
23         protected void finalize() throws Throwable {
24                 super.finalize();
25                 if (ptr != 0) { bindings.TrustedClosingTransaction_free(ptr); }
26         }
27
28         /**
29          * The pre-built Bitcoin commitment transaction
30          */
31         public byte[] built_transaction() {
32                 byte[] ret = bindings.TrustedClosingTransaction_built_transaction(this.ptr);
33                 Reference.reachabilityFence(this);
34                 return ret;
35         }
36
37         /**
38          * Get the SIGHASH_ALL sighash value of the transaction.
39          * 
40          * This can be used to verify a signature.
41          */
42         public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) {
43                 byte[] ret = bindings.TrustedClosingTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis);
44                 Reference.reachabilityFence(this);
45                 Reference.reachabilityFence(funding_redeemscript);
46                 Reference.reachabilityFence(channel_value_satoshis);
47                 return ret;
48         }
49
50         /**
51          * Sign a transaction, either because we are counter-signing the counterparty's transaction or
52          * because we are about to broadcast a holder transaction.
53          */
54         public byte[] sign(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) {
55                 byte[] ret = bindings.TrustedClosingTransaction_sign(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis);
56                 Reference.reachabilityFence(this);
57                 Reference.reachabilityFence(funding_key);
58                 Reference.reachabilityFence(funding_redeemscript);
59                 Reference.reachabilityFence(channel_value_satoshis);
60                 return ret;
61         }
62
63 }