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 wrapper on ClosingTransaction indicating that the built bitcoin
13 * transaction is trusted.
15 * See trust() and verify() functions on CommitmentTransaction.
17 * This structure implements Deref.
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 {
25 if (ptr != 0) { bindings.TrustedClosingTransaction_free(ptr); }
29 * The pre-built Bitcoin commitment transaction
31 public byte[] built_transaction() {
32 byte[] ret = bindings.TrustedClosingTransaction_built_transaction(this.ptr);
33 Reference.reachabilityFence(this);
38 * Get the SIGHASH_ALL sighash value of the transaction.
40 * This can be used to verify a signature.
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);
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.
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);