6 namespace org { namespace ldk { namespace structs {
10 * A wrapper on ClosingTransaction indicating that the built bitcoin
11 * transaction is trusted.
13 * See trust() and verify() functions on CommitmentTransaction.
15 * This structure implements Deref.
17 public class TrustedClosingTransaction : CommonBase {
18 internal TrustedClosingTransaction(object _dummy, long ptr) : base(ptr) { }
19 ~TrustedClosingTransaction() {
20 if (ptr != 0) { bindings.TrustedClosingTransaction_free(ptr); }
24 * The pre-built Bitcoin commitment transaction
26 public byte[] built_transaction() {
27 long ret = bindings.TrustedClosingTransaction_built_transaction(this.ptr);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
35 * Get the SIGHASH_ALL sighash value of the transaction.
37 * This can be used to verify a signature.
39 public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) {
40 long ret = bindings.TrustedClosingTransaction_get_sighash_all(this.ptr, InternalUtils.encodeUint8Array(funding_redeemscript), channel_value_satoshis);
42 GC.KeepAlive(funding_redeemscript);
43 GC.KeepAlive(channel_value_satoshis);
44 if (ret >= 0 && ret <= 4096) { return null; }
45 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
50 * Sign a transaction, either because we are counter-signing the counterparty's transaction or
51 * because we are about to broadcast a holder transaction.
53 public byte[] sign(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) {
54 long ret = bindings.TrustedClosingTransaction_sign(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_key, 32)), InternalUtils.encodeUint8Array(funding_redeemscript), channel_value_satoshis);
56 GC.KeepAlive(funding_key);
57 GC.KeepAlive(funding_redeemscript);
58 GC.KeepAlive(channel_value_satoshis);
59 if (ret >= 0 && ret <= 4096) { return null; }
60 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);