6 namespace org { namespace ldk { namespace structs {
10 * A [`commitment_signed`] message to be sent to or received from a peer.
12 * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed
14 public class CommitmentSigned : CommonBase {
15 internal CommitmentSigned(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.CommitmentSigned_free(ptr); }
23 public byte[] get_channel_id() {
24 byte[] ret = bindings.CommitmentSigned_get_channel_id(this.ptr);
32 public void set_channel_id(byte[] val) {
33 bindings.CommitmentSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39 * A signature on the commitment transaction
41 public byte[] get_signature() {
42 byte[] ret = bindings.CommitmentSigned_get_signature(this.ptr);
48 * A signature on the commitment transaction
50 public void set_signature(byte[] val) {
51 bindings.CommitmentSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
57 * Signatures on the HTLC transactions
59 * Returns a copy of the field.
61 public byte[][] get_htlc_signatures() {
62 byte[][] ret = bindings.CommitmentSigned_get_htlc_signatures(this.ptr);
68 * Signatures on the HTLC transactions
70 public void set_htlc_signatures(byte[][] val) {
71 bindings.CommitmentSigned_set_htlc_signatures(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_8 => InternalUtils.check_arr_len(val_conv_8, 64)) : null);
77 * Constructs a new CommitmentSigned given each field
79 public static CommitmentSigned of(byte[] channel_id_arg, byte[] signature_arg, byte[][] htlc_signatures_arg) {
80 long ret = bindings.CommitmentSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(signature_arg, 64), htlc_signatures_arg != null ? InternalUtils.mapArray(htlc_signatures_arg, htlc_signatures_arg_conv_8 => InternalUtils.check_arr_len(htlc_signatures_arg_conv_8, 64)) : null);
81 GC.KeepAlive(channel_id_arg);
82 GC.KeepAlive(signature_arg);
83 GC.KeepAlive(htlc_signatures_arg);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentSigned(null, ret); }
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
90 internal long clone_ptr() {
91 long ret = bindings.CommitmentSigned_clone_ptr(this.ptr);
97 * Creates a copy of the CommitmentSigned
99 public CommitmentSigned clone() {
100 long ret = bindings.CommitmentSigned_clone(this.ptr);
102 if (ret >= 0 && ret <= 4096) { return null; }
103 org.ldk.structs.CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentSigned(null, ret); }
104 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
109 * Checks if two CommitmentSigneds contain equal inner contents.
110 * This ignores pointers and is_owned flags and looks at the values in fields.
111 * Two objects with NULL inner values will be considered "equal" here.
113 public bool eq(org.ldk.structs.CommitmentSigned b) {
114 bool ret = bindings.CommitmentSigned_eq(this.ptr, b == null ? 0 : b.ptr);
117 if (this != null) { this.ptrs_to.AddLast(b); };
121 public override bool Equals(object o) {
122 if (!(o is CommitmentSigned)) return false;
123 return this.eq((CommitmentSigned)o);
126 * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
128 public byte[] write() {
129 byte[] ret = bindings.CommitmentSigned_write(this.ptr);
135 * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
137 public static Result_CommitmentSignedDecodeErrorZ read(byte[] ser) {
138 long ret = bindings.CommitmentSigned_read(ser);
140 if (ret >= 0 && ret <= 4096) { return null; }
141 Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret);