6 namespace org { namespace ldk { namespace structs {
10 * A pre-built Bitcoin commitment transaction and its txid.
12 public class BuiltCommitmentTransaction : CommonBase {
13 internal BuiltCommitmentTransaction(object _dummy, long ptr) : base(ptr) { }
14 ~BuiltCommitmentTransaction() {
15 if (ptr != 0) { bindings.BuiltCommitmentTransaction_free(ptr); }
19 * The commitment transaction
21 public byte[] get_transaction() {
22 byte[] ret = bindings.BuiltCommitmentTransaction_get_transaction(this.ptr);
28 * The commitment transaction
30 public void set_transaction(byte[] val) {
31 bindings.BuiltCommitmentTransaction_set_transaction(this.ptr, val);
37 * The txid for the commitment transaction.
39 * This is provided as a performance optimization, instead of calling transaction.txid()
42 public byte[] get_txid() {
43 byte[] ret = bindings.BuiltCommitmentTransaction_get_txid(this.ptr);
49 * The txid for the commitment transaction.
51 * This is provided as a performance optimization, instead of calling transaction.txid()
54 public void set_txid(byte[] val) {
55 bindings.BuiltCommitmentTransaction_set_txid(this.ptr, InternalUtils.check_arr_len(val, 32));
61 * Constructs a new BuiltCommitmentTransaction given each field
63 public static BuiltCommitmentTransaction of(byte[] transaction_arg, byte[] txid_arg) {
64 long ret = bindings.BuiltCommitmentTransaction_new(transaction_arg, InternalUtils.check_arr_len(txid_arg, 32));
65 GC.KeepAlive(transaction_arg);
66 GC.KeepAlive(txid_arg);
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BuiltCommitmentTransaction(null, ret); }
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
73 internal long clone_ptr() {
74 long ret = bindings.BuiltCommitmentTransaction_clone_ptr(this.ptr);
80 * Creates a copy of the BuiltCommitmentTransaction
82 public BuiltCommitmentTransaction clone() {
83 long ret = bindings.BuiltCommitmentTransaction_clone(this.ptr);
85 if (ret >= 0 && ret <= 4096) { return null; }
86 org.ldk.structs.BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BuiltCommitmentTransaction(null, ret); }
87 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
92 * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
94 public byte[] write() {
95 byte[] ret = bindings.BuiltCommitmentTransaction_write(this.ptr);
101 * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
103 public static Result_BuiltCommitmentTransactionDecodeErrorZ read(byte[] ser) {
104 long ret = bindings.BuiltCommitmentTransaction_read(ser);
106 if (ret >= 0 && ret <= 4096) { return null; }
107 Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret);
112 * Get the SIGHASH_ALL sighash value of the transaction.
114 * This can be used to verify a signature.
116 public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) {
117 byte[] ret = bindings.BuiltCommitmentTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis);
119 GC.KeepAlive(funding_redeemscript);
120 GC.KeepAlive(channel_value_satoshis);
125 * Signs the counterparty's commitment transaction.
127 public byte[] sign_counterparty_commitment(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) {
128 byte[] ret = bindings.BuiltCommitmentTransaction_sign_counterparty_commitment(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis);
130 GC.KeepAlive(funding_key);
131 GC.KeepAlive(funding_redeemscript);
132 GC.KeepAlive(channel_value_satoshis);
137 * Signs the holder commitment transaction because we are about to broadcast it.
139 public byte[] sign_holder_commitment(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis, org.ldk.structs.EntropySource entropy_source) {
140 byte[] ret = bindings.BuiltCommitmentTransaction_sign_holder_commitment(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis, entropy_source.ptr);
142 GC.KeepAlive(funding_key);
143 GC.KeepAlive(funding_redeemscript);
144 GC.KeepAlive(channel_value_satoshis);
145 GC.KeepAlive(entropy_source);
146 if (this != null) { this.ptrs_to.AddLast(entropy_source); };