6 namespace org { namespace ldk { namespace structs {
10 * A commitment_signed message to be sent or received from a peer
12 public class CommitmentSigned : CommonBase {
13 internal CommitmentSigned(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.CommitmentSigned_free(ptr); }
21 public byte[] get_channel_id() {
22 byte[] ret = bindings.CommitmentSigned_get_channel_id(this.ptr);
30 public void set_channel_id(byte[] val) {
31 bindings.CommitmentSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 * A signature on the commitment transaction
39 public byte[] get_signature() {
40 byte[] ret = bindings.CommitmentSigned_get_signature(this.ptr);
46 * A signature on the commitment transaction
48 public void set_signature(byte[] val) {
49 bindings.CommitmentSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
55 * Signatures on the HTLC transactions
57 * Returns a copy of the field.
59 public byte[][] get_htlc_signatures() {
60 byte[][] ret = bindings.CommitmentSigned_get_htlc_signatures(this.ptr);
66 * Signatures on the HTLC transactions
68 public void set_htlc_signatures(byte[][] val) {
69 bindings.CommitmentSigned_set_htlc_signatures(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_8 => InternalUtils.check_arr_len(val_conv_8, 64)) : null);
75 * Constructs a new CommitmentSigned given each field
77 public static CommitmentSigned of(byte[] channel_id_arg, byte[] signature_arg, byte[][] htlc_signatures_arg) {
78 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);
79 GC.KeepAlive(channel_id_arg);
80 GC.KeepAlive(signature_arg);
81 GC.KeepAlive(htlc_signatures_arg);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentSigned(null, ret); }
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
88 internal long clone_ptr() {
89 long ret = bindings.CommitmentSigned_clone_ptr(this.ptr);
95 * Creates a copy of the CommitmentSigned
97 public CommitmentSigned clone() {
98 long ret = bindings.CommitmentSigned_clone(this.ptr);
100 if (ret >= 0 && ret <= 4096) { return null; }
101 org.ldk.structs.CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentSigned(null, ret); }
102 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
107 * Checks if two CommitmentSigneds contain equal inner contents.
108 * This ignores pointers and is_owned flags and looks at the values in fields.
109 * Two objects with NULL inner values will be considered "equal" here.
111 public bool eq(org.ldk.structs.CommitmentSigned b) {
112 bool ret = bindings.CommitmentSigned_eq(this.ptr, b == null ? 0 : b.ptr);
115 if (this != null) { this.ptrs_to.AddLast(b); };
119 public override bool Equals(object o) {
120 if (!(o is CommitmentSigned)) return false;
121 return this.eq((CommitmentSigned)o);
124 * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
126 public byte[] write() {
127 byte[] ret = bindings.CommitmentSigned_write(this.ptr);
133 * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
135 public static Result_CommitmentSignedDecodeErrorZ read(byte[] ser) {
136 long ret = bindings.CommitmentSigned_read(ser);
138 if (ret >= 0 && ret <= 4096) { return null; }
139 Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret);