6 namespace org { namespace ldk { namespace structs {
10 * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
11 * transaction updates if they were pending.
13 public class CommitmentUpdate : CommonBase {
14 internal CommitmentUpdate(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.CommitmentUpdate_free(ptr); }
20 * update_add_htlc messages which should be sent
22 public UpdateAddHTLC[] get_update_add_htlcs() {
23 long[] ret = bindings.CommitmentUpdate_get_update_add_htlcs(this.ptr);
25 int ret_conv_15_len = ret.Length;
26 UpdateAddHTLC[] ret_conv_15_arr = new UpdateAddHTLC[ret_conv_15_len];
27 for (int p = 0; p < ret_conv_15_len; p++) {
28 long ret_conv_15 = ret[p];
29 org.ldk.structs.UpdateAddHTLC ret_conv_15_hu_conv = null; if (ret_conv_15 < 0 || ret_conv_15 > 4096) { ret_conv_15_hu_conv = new org.ldk.structs.UpdateAddHTLC(null, ret_conv_15); }
30 if (ret_conv_15_hu_conv != null) { ret_conv_15_hu_conv.ptrs_to.AddLast(this); };
31 ret_conv_15_arr[p] = ret_conv_15_hu_conv;
33 return ret_conv_15_arr;
37 * update_add_htlc messages which should be sent
39 public void set_update_add_htlcs(UpdateAddHTLC[] val) {
40 bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_15 => val_conv_15 == null ? 0 : val_conv_15.ptr) : null);
43 foreach (UpdateAddHTLC val_conv_15 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_15); }; };
47 * update_fulfill_htlc messages which should be sent
49 public UpdateFulfillHTLC[] get_update_fulfill_htlcs() {
50 long[] ret = bindings.CommitmentUpdate_get_update_fulfill_htlcs(this.ptr);
52 int ret_conv_19_len = ret.Length;
53 UpdateFulfillHTLC[] ret_conv_19_arr = new UpdateFulfillHTLC[ret_conv_19_len];
54 for (int t = 0; t < ret_conv_19_len; t++) {
55 long ret_conv_19 = ret[t];
56 org.ldk.structs.UpdateFulfillHTLC ret_conv_19_hu_conv = null; if (ret_conv_19 < 0 || ret_conv_19 > 4096) { ret_conv_19_hu_conv = new org.ldk.structs.UpdateFulfillHTLC(null, ret_conv_19); }
57 if (ret_conv_19_hu_conv != null) { ret_conv_19_hu_conv.ptrs_to.AddLast(this); };
58 ret_conv_19_arr[t] = ret_conv_19_hu_conv;
60 return ret_conv_19_arr;
64 * update_fulfill_htlc messages which should be sent
66 public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) {
67 bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_19 => val_conv_19 == null ? 0 : val_conv_19.ptr) : null);
70 foreach (UpdateFulfillHTLC val_conv_19 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_19); }; };
74 * update_fail_htlc messages which should be sent
76 public UpdateFailHTLC[] get_update_fail_htlcs() {
77 long[] ret = bindings.CommitmentUpdate_get_update_fail_htlcs(this.ptr);
79 int ret_conv_16_len = ret.Length;
80 UpdateFailHTLC[] ret_conv_16_arr = new UpdateFailHTLC[ret_conv_16_len];
81 for (int q = 0; q < ret_conv_16_len; q++) {
82 long ret_conv_16 = ret[q];
83 org.ldk.structs.UpdateFailHTLC ret_conv_16_hu_conv = null; if (ret_conv_16 < 0 || ret_conv_16 > 4096) { ret_conv_16_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, ret_conv_16); }
84 if (ret_conv_16_hu_conv != null) { ret_conv_16_hu_conv.ptrs_to.AddLast(this); };
85 ret_conv_16_arr[q] = ret_conv_16_hu_conv;
87 return ret_conv_16_arr;
91 * update_fail_htlc messages which should be sent
93 public void set_update_fail_htlcs(UpdateFailHTLC[] val) {
94 bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_16 => val_conv_16 == null ? 0 : val_conv_16.ptr) : null);
97 foreach (UpdateFailHTLC val_conv_16 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_16); }; };
101 * update_fail_malformed_htlc messages which should be sent
103 public UpdateFailMalformedHTLC[] get_update_fail_malformed_htlcs() {
104 long[] ret = bindings.CommitmentUpdate_get_update_fail_malformed_htlcs(this.ptr);
106 int ret_conv_25_len = ret.Length;
107 UpdateFailMalformedHTLC[] ret_conv_25_arr = new UpdateFailMalformedHTLC[ret_conv_25_len];
108 for (int z = 0; z < ret_conv_25_len; z++) {
109 long ret_conv_25 = ret[z];
110 org.ldk.structs.UpdateFailMalformedHTLC ret_conv_25_hu_conv = null; if (ret_conv_25 < 0 || ret_conv_25 > 4096) { ret_conv_25_hu_conv = new org.ldk.structs.UpdateFailMalformedHTLC(null, ret_conv_25); }
111 if (ret_conv_25_hu_conv != null) { ret_conv_25_hu_conv.ptrs_to.AddLast(this); };
112 ret_conv_25_arr[z] = ret_conv_25_hu_conv;
114 return ret_conv_25_arr;
118 * update_fail_malformed_htlc messages which should be sent
120 public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) {
121 bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_25 => val_conv_25 == null ? 0 : val_conv_25.ptr) : null);
124 foreach (UpdateFailMalformedHTLC val_conv_25 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_25); }; };
128 * An update_fee message which should be sent
130 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
132 public UpdateFee get_update_fee() {
133 long ret = bindings.CommitmentUpdate_get_update_fee(this.ptr);
135 if (ret >= 0 && ret <= 4096) { return null; }
136 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
137 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
142 * An update_fee message which should be sent
144 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
146 public void set_update_fee(org.ldk.structs.UpdateFee val) {
147 bindings.CommitmentUpdate_set_update_fee(this.ptr, val == null ? 0 : val.ptr);
150 if (this != null) { this.ptrs_to.AddLast(val); };
154 * Finally, the commitment_signed message which should be sent
156 public CommitmentSigned get_commitment_signed() {
157 long ret = bindings.CommitmentUpdate_get_commitment_signed(this.ptr);
159 if (ret >= 0 && ret <= 4096) { return null; }
160 org.ldk.structs.CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentSigned(null, ret); }
161 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
166 * Finally, the commitment_signed message which should be sent
168 public void set_commitment_signed(org.ldk.structs.CommitmentSigned val) {
169 bindings.CommitmentUpdate_set_commitment_signed(this.ptr, val == null ? 0 : val.ptr);
172 if (this != null) { this.ptrs_to.AddLast(val); };
176 * Constructs a new CommitmentUpdate given each field
178 public static CommitmentUpdate of(UpdateAddHTLC[] update_add_htlcs_arg, UpdateFulfillHTLC[] update_fulfill_htlcs_arg, UpdateFailHTLC[] update_fail_htlcs_arg, UpdateFailMalformedHTLC[] update_fail_malformed_htlcs_arg, org.ldk.structs.UpdateFee update_fee_arg, org.ldk.structs.CommitmentSigned commitment_signed_arg) {
179 long ret = bindings.CommitmentUpdate_new(update_add_htlcs_arg != null ? InternalUtils.mapArray(update_add_htlcs_arg, update_add_htlcs_arg_conv_15 => update_add_htlcs_arg_conv_15 == null ? 0 : update_add_htlcs_arg_conv_15.ptr) : null, update_fulfill_htlcs_arg != null ? InternalUtils.mapArray(update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_conv_19 => update_fulfill_htlcs_arg_conv_19 == null ? 0 : update_fulfill_htlcs_arg_conv_19.ptr) : null, update_fail_htlcs_arg != null ? InternalUtils.mapArray(update_fail_htlcs_arg, update_fail_htlcs_arg_conv_16 => update_fail_htlcs_arg_conv_16 == null ? 0 : update_fail_htlcs_arg_conv_16.ptr) : null, update_fail_malformed_htlcs_arg != null ? InternalUtils.mapArray(update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_conv_25 => update_fail_malformed_htlcs_arg_conv_25 == null ? 0 : update_fail_malformed_htlcs_arg_conv_25.ptr) : null, update_fee_arg == null ? 0 : update_fee_arg.ptr, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr);
180 GC.KeepAlive(update_add_htlcs_arg);
181 GC.KeepAlive(update_fulfill_htlcs_arg);
182 GC.KeepAlive(update_fail_htlcs_arg);
183 GC.KeepAlive(update_fail_malformed_htlcs_arg);
184 GC.KeepAlive(update_fee_arg);
185 GC.KeepAlive(commitment_signed_arg);
186 if (ret >= 0 && ret <= 4096) { return null; }
187 org.ldk.structs.CommitmentUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentUpdate(null, ret); }
188 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
189 foreach (UpdateAddHTLC update_add_htlcs_arg_conv_15 in update_add_htlcs_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(update_add_htlcs_arg_conv_15); }; };
190 foreach (UpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19 in update_fulfill_htlcs_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(update_fulfill_htlcs_arg_conv_19); }; };
191 foreach (UpdateFailHTLC update_fail_htlcs_arg_conv_16 in update_fail_htlcs_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(update_fail_htlcs_arg_conv_16); }; };
192 foreach (UpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25 in update_fail_malformed_htlcs_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(update_fail_malformed_htlcs_arg_conv_25); }; };
193 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(update_fee_arg); };
194 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(commitment_signed_arg); };
198 internal long clone_ptr() {
199 long ret = bindings.CommitmentUpdate_clone_ptr(this.ptr);
205 * Creates a copy of the CommitmentUpdate
207 public CommitmentUpdate clone() {
208 long ret = bindings.CommitmentUpdate_clone(this.ptr);
210 if (ret >= 0 && ret <= 4096) { return null; }
211 org.ldk.structs.CommitmentUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentUpdate(null, ret); }
212 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
217 * Checks if two CommitmentUpdates contain equal inner contents.
218 * This ignores pointers and is_owned flags and looks at the values in fields.
219 * Two objects with NULL inner values will be considered "equal" here.
221 public bool eq(org.ldk.structs.CommitmentUpdate b) {
222 bool ret = bindings.CommitmentUpdate_eq(this.ptr, b == null ? 0 : b.ptr);
225 if (this != null) { this.ptrs_to.AddLast(b); };
229 public override bool Equals(object o) {
230 if (!(o is CommitmentUpdate)) return false;
231 return this.eq((CommitmentUpdate)o);