1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
11 * transaction and the transaction creation keys) are trusted.
13 * See trust() and verify() functions on CommitmentTransaction.
15 * This structure implements Deref.
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class TrustedCommitmentTransaction extends CommonBase {
19 TrustedCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
20 @Override @SuppressWarnings("deprecation")
21 protected void finalize() throws Throwable {
23 if (ptr != 0) { bindings.TrustedCommitmentTransaction_free(ptr); }
27 * The transaction ID of the built Bitcoin transaction
29 public byte[] txid() {
30 byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr);
35 * The pre-built Bitcoin commitment transaction
37 public BuiltCommitmentTransaction built_transaction() {
38 long ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr);
39 BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret);
40 ret_hu_conv.ptrs_to.add(this);
45 * The pre-calculated transaction creation public keys.
47 public TxCreationKeys keys() {
48 long ret = bindings.TrustedCommitmentTransaction_keys(this.ptr);
49 TxCreationKeys ret_hu_conv = new TxCreationKeys(null, ret);
50 ret_hu_conv.ptrs_to.add(this);
55 * Get a signature for each HTLC which was included in the commitment transaction (ie for
56 * which HTLCOutputInCommitment::transaction_output_index.is_some()).
58 * The returned Vec has one entry for each HTLC, and in the same order.
60 public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) {
61 long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, htlc_base_key, channel_parameters == null ? 0 : channel_parameters.ptr & ~1);
62 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
63 this.ptrs_to.add(channel_parameters);