6 namespace org { namespace ldk { namespace structs {
10 * Information needed to build and sign a holder's commitment transaction.
12 * The transaction is only signed once we are ready to broadcast.
14 public class HolderCommitmentTransaction : CommonBase {
15 internal HolderCommitmentTransaction(object _dummy, long ptr) : base(ptr) { }
16 ~HolderCommitmentTransaction() {
17 if (ptr != 0) { bindings.HolderCommitmentTransaction_free(ptr); }
21 * Our counterparty's signature for the transaction
23 public byte[] get_counterparty_sig() {
24 byte[] ret = bindings.HolderCommitmentTransaction_get_counterparty_sig(this.ptr);
30 * Our counterparty's signature for the transaction
32 public void set_counterparty_sig(byte[] val) {
33 bindings.HolderCommitmentTransaction_set_counterparty_sig(this.ptr, InternalUtils.check_arr_len(val, 64));
39 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
41 * Returns a copy of the field.
43 public byte[][] get_counterparty_htlc_sigs() {
44 byte[][] ret = bindings.HolderCommitmentTransaction_get_counterparty_htlc_sigs(this.ptr);
50 * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
52 public void set_counterparty_htlc_sigs(byte[][] val) {
53 bindings.HolderCommitmentTransaction_set_counterparty_htlc_sigs(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_8 => InternalUtils.check_arr_len(val_conv_8, 64)) : null);
58 internal long clone_ptr() {
59 long ret = bindings.HolderCommitmentTransaction_clone_ptr(this.ptr);
65 * Creates a copy of the HolderCommitmentTransaction
67 public HolderCommitmentTransaction clone() {
68 long ret = bindings.HolderCommitmentTransaction_clone(this.ptr);
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.HolderCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, ret); }
72 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
77 * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
79 public byte[] write() {
80 byte[] ret = bindings.HolderCommitmentTransaction_write(this.ptr);
86 * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
88 public static Result_HolderCommitmentTransactionDecodeErrorZ read(byte[] ser) {
89 long ret = bindings.HolderCommitmentTransaction_read(ser);
91 if (ret >= 0 && ret <= 4096) { return null; }
92 Result_HolderCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret);
97 * Create a new holder transaction with the given counterparty signatures.
98 * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
100 public static HolderCommitmentTransaction of(org.ldk.structs.CommitmentTransaction commitment_tx, byte[] counterparty_sig, byte[][] counterparty_htlc_sigs, byte[] holder_funding_key, byte[] counterparty_funding_key) {
101 long ret = bindings.HolderCommitmentTransaction_new(commitment_tx == null ? 0 : commitment_tx.ptr, InternalUtils.check_arr_len(counterparty_sig, 64), counterparty_htlc_sigs != null ? InternalUtils.mapArray(counterparty_htlc_sigs, counterparty_htlc_sigs_conv_8 => InternalUtils.check_arr_len(counterparty_htlc_sigs_conv_8, 64)) : null, InternalUtils.check_arr_len(holder_funding_key, 33), InternalUtils.check_arr_len(counterparty_funding_key, 33));
102 GC.KeepAlive(commitment_tx);
103 GC.KeepAlive(counterparty_sig);
104 GC.KeepAlive(counterparty_htlc_sigs);
105 GC.KeepAlive(holder_funding_key);
106 GC.KeepAlive(counterparty_funding_key);
107 if (ret >= 0 && ret <= 4096) { return null; }
108 org.ldk.structs.HolderCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, ret); }
109 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(commitment_tx); };