1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
12 * transaction and the transaction creation keys) are trusted.
14 * See trust() and verify() functions on CommitmentTransaction.
16 * This structure implements Deref.
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class TrustedCommitmentTransaction extends CommonBase {
20 TrustedCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
21 @Override @SuppressWarnings("deprecation")
22 protected void finalize() throws Throwable {
24 if (ptr != 0) { bindings.TrustedCommitmentTransaction_free(ptr); }
28 * The transaction ID of the built Bitcoin transaction
30 public byte[] txid() {
31 byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr);
36 * The pre-built Bitcoin commitment transaction
38 public BuiltCommitmentTransaction built_transaction() {
39 long ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr);
40 if (ret < 1024) { return null; }
41 BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret);
42 ret_hu_conv.ptrs_to.add(this);
47 * The pre-calculated transaction creation public keys.
49 public TxCreationKeys keys() {
50 long ret = bindings.TrustedCommitmentTransaction_keys(this.ptr);
51 if (ret < 1024) { return null; }
52 TxCreationKeys ret_hu_conv = new TxCreationKeys(null, ret);
53 ret_hu_conv.ptrs_to.add(this);
58 * Get a signature for each HTLC which was included in the commitment transaction (ie for
59 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
61 * The returned Vec has one entry for each HTLC, and in the same order.
63 public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) {
64 long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, htlc_base_key, channel_parameters == null ? 0 : channel_parameters.ptr & ~1);
65 if (ret < 1024) { return null; }
66 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
67 this.ptrs_to.add(channel_parameters);