[Java] Print error stack trace when tests fail
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelConfig.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
11  * with our counterparty.
12  */
13 public class ChannelConfig : CommonBase {
14         internal ChannelConfig(object _dummy, long ptr) : base(ptr) { }
15         ~ChannelConfig() {
16                 if (ptr != 0) { bindings.ChannelConfig_free(ptr); }
17         }
18
19         /**
20          * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
21          * over the channel.
22          * This may be allowed to change at runtime in a later update, however doing so must result in
23          * update messages sent to notify all nodes of our updated relay fee.
24          * 
25          * Default value: 0.
26          */
27         public int get_forwarding_fee_proportional_millionths() {
28                 int ret = bindings.ChannelConfig_get_forwarding_fee_proportional_millionths(this.ptr);
29                 GC.KeepAlive(this);
30                 return ret;
31         }
32
33         /**
34          * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
35          * over the channel.
36          * This may be allowed to change at runtime in a later update, however doing so must result in
37          * update messages sent to notify all nodes of our updated relay fee.
38          * 
39          * Default value: 0.
40          */
41         public void set_forwarding_fee_proportional_millionths(int val) {
42                 bindings.ChannelConfig_set_forwarding_fee_proportional_millionths(this.ptr, val);
43                 GC.KeepAlive(this);
44                 GC.KeepAlive(val);
45         }
46
47         /**
48          * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
49          * excess of [`forwarding_fee_proportional_millionths`].
50          * This may be allowed to change at runtime in a later update, however doing so must result in
51          * update messages sent to notify all nodes of our updated relay fee.
52          * 
53          * The default value of a single satoshi roughly matches the market rate on many routing nodes
54          * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
55          * this node.
56          * 
57          * Default value: 1000.
58          * 
59          * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
60          */
61         public int get_forwarding_fee_base_msat() {
62                 int ret = bindings.ChannelConfig_get_forwarding_fee_base_msat(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
69          * excess of [`forwarding_fee_proportional_millionths`].
70          * This may be allowed to change at runtime in a later update, however doing so must result in
71          * update messages sent to notify all nodes of our updated relay fee.
72          * 
73          * The default value of a single satoshi roughly matches the market rate on many routing nodes
74          * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
75          * this node.
76          * 
77          * Default value: 1000.
78          * 
79          * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
80          */
81         public void set_forwarding_fee_base_msat(int val) {
82                 bindings.ChannelConfig_set_forwarding_fee_base_msat(this.ptr, val);
83                 GC.KeepAlive(this);
84                 GC.KeepAlive(val);
85         }
86
87         /**
88          * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
89          * the channel this config applies to.
90          * 
91          * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
92          * HTLC balance when a channel appears on-chain whereas
93          * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
94          * (non-HTLC-encumbered) balance.
95          * 
96          * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
97          * we (or one of our watchtowers) MUST be online to check for broadcast of the current
98          * commitment transaction at least once per this many blocks (minus some margin to allow us
99          * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
100          * the spending transaction).
101          * 
102          * Default value: 72 (12 hours at an average of 6 blocks/hour).
103          * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
104          * [`MIN_CLTV_EXPIRY_DELTA`] instead.
105          * 
106          * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
107          */
108         public short get_cltv_expiry_delta() {
109                 short ret = bindings.ChannelConfig_get_cltv_expiry_delta(this.ptr);
110                 GC.KeepAlive(this);
111                 return ret;
112         }
113
114         /**
115          * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
116          * the channel this config applies to.
117          * 
118          * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
119          * HTLC balance when a channel appears on-chain whereas
120          * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
121          * (non-HTLC-encumbered) balance.
122          * 
123          * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
124          * we (or one of our watchtowers) MUST be online to check for broadcast of the current
125          * commitment transaction at least once per this many blocks (minus some margin to allow us
126          * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
127          * the spending transaction).
128          * 
129          * Default value: 72 (12 hours at an average of 6 blocks/hour).
130          * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
131          * [`MIN_CLTV_EXPIRY_DELTA`] instead.
132          * 
133          * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
134          */
135         public void set_cltv_expiry_delta(short val) {
136                 bindings.ChannelConfig_set_cltv_expiry_delta(this.ptr, val);
137                 GC.KeepAlive(this);
138                 GC.KeepAlive(val);
139         }
140
141         /**
142          * Limit our total exposure to potential loss to on-chain fees on close, including in-flight
143          * HTLCs which are burned to fees as they are too small to claim on-chain and fees on
144          * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate.
145          * 
146          * # HTLC-based Dust Exposure
147          * 
148          * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
149          * not be claimable on-chain, instead being turned into additional miner fees if either
150          * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
151          * to such payments may be substantial if there are many dust HTLCs present when the
152          * channel is force-closed.
153          * 
154          * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
155          * channel negotiated throughout the channel open process, along with the fees required to have
156          * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
157          * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
158          * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
159          * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
160          * variant is primarily intended for use with pre-anchor channels.
161          * 
162          * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
163          * exposure across all three types per-channel.
164          * 
165          * # Transaction Fee Dust Exposure
166          * 
167          * Further, counterparties broadcasting a commitment transaction in a force-close may result
168          * in other balance being burned to fees, and thus all fees on commitment and HTLC
169          * transactions in excess of our local fee estimates are included in the dust calculation.
170          * 
171          * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750
172          * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per
173          * non-dust HTLC we're allowed to have with our peers before risking a force-closure for
174          * inbound channels.
175          * 
176          * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500
177          * sat/KW), we risk force-closure if we disagree with our peer by:
178          * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in
179          * both directions (the maximum),
180          * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both
181          * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
182          * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs
183          * in both directions (the maximum),
184          * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs
185          * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
186          * 
187          * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement
188          * will scale linearly with increases (or decreases) in the our feerate estimates. Further,
189          * for anchor channels we expect our counterparty to use a relatively low feerate estimate
190          * while we use [`ConfirmationTarget::OnChainSweep`] (which should be relatively high) and
191          * feerate disagreement force-closures should only occur when theirs is higher than ours.
192          * 
193          * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 10_000.
194          * 
195          * [`ConfirmationTarget::OnChainSweep`]: crate::chain::chaininterface::ConfirmationTarget::OnChainSweep
196          */
197         public MaxDustHTLCExposure get_max_dust_htlc_exposure() {
198                 long ret = bindings.ChannelConfig_get_max_dust_htlc_exposure(this.ptr);
199                 GC.KeepAlive(this);
200                 if (ret >= 0 && ret <= 4096) { return null; }
201                 org.ldk.structs.MaxDustHTLCExposure ret_hu_conv = org.ldk.structs.MaxDustHTLCExposure.constr_from_ptr(ret);
202                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
203                 return ret_hu_conv;
204         }
205
206         /**
207          * Limit our total exposure to potential loss to on-chain fees on close, including in-flight
208          * HTLCs which are burned to fees as they are too small to claim on-chain and fees on
209          * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate.
210          * 
211          * # HTLC-based Dust Exposure
212          * 
213          * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
214          * not be claimable on-chain, instead being turned into additional miner fees if either
215          * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
216          * to such payments may be substantial if there are many dust HTLCs present when the
217          * channel is force-closed.
218          * 
219          * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
220          * channel negotiated throughout the channel open process, along with the fees required to have
221          * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
222          * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
223          * account the HTLC transaction fee as it is zero. Because of this, you may want to set this
224          * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier
225          * variant is primarily intended for use with pre-anchor channels.
226          * 
227          * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total
228          * exposure across all three types per-channel.
229          * 
230          * # Transaction Fee Dust Exposure
231          * 
232          * Further, counterparties broadcasting a commitment transaction in a force-close may result
233          * in other balance being burned to fees, and thus all fees on commitment and HTLC
234          * transactions in excess of our local fee estimates are included in the dust calculation.
235          * 
236          * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750
237          * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per
238          * non-dust HTLC we're allowed to have with our peers before risking a force-closure for
239          * inbound channels.
240          * 
241          * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500
242          * sat/KW), we risk force-closure if we disagree with our peer by:
243          * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in
244          * both directions (the maximum),
245          * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both
246          * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
247          * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs
248          * in both directions (the maximum),
249          * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs
250          * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`])
251          * 
252          * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement
253          * will scale linearly with increases (or decreases) in the our feerate estimates. Further,
254          * for anchor channels we expect our counterparty to use a relatively low feerate estimate
255          * while we use [`ConfirmationTarget::OnChainSweep`] (which should be relatively high) and
256          * feerate disagreement force-closures should only occur when theirs is higher than ours.
257          * 
258          * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 10_000.
259          * 
260          * [`ConfirmationTarget::OnChainSweep`]: crate::chain::chaininterface::ConfirmationTarget::OnChainSweep
261          */
262         public void set_max_dust_htlc_exposure(org.ldk.structs.MaxDustHTLCExposure val) {
263                 bindings.ChannelConfig_set_max_dust_htlc_exposure(this.ptr, val.ptr);
264                 GC.KeepAlive(this);
265                 GC.KeepAlive(val);
266                 if (this != null) { this.ptrs_to.AddLast(val); };
267         }
268
269         /**
270          * The additional fee we're willing to pay to avoid waiting for the counterparty's
271          * `to_self_delay` to reclaim funds.
272          * 
273          * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
274          * closing transaction which both sides find acceptable, ultimately paid by the channel
275          * funder/initiator.
276          * 
277          * When we are the funder, because we have to pay the channel closing fee, we bound the
278          * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
279          * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
280          * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
281          * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
282          * funds.
283          * 
284          * When we are not the funder, we require the closing transaction fee pay at least our
285          * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
286          * Thus, this value is ignored when we are not the funder.
287          * 
288          * Default value: 1000 satoshis.
289          * 
290          * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
291          * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
292          */
293         public long get_force_close_avoidance_max_fee_satoshis() {
294                 long ret = bindings.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this.ptr);
295                 GC.KeepAlive(this);
296                 return ret;
297         }
298
299         /**
300          * The additional fee we're willing to pay to avoid waiting for the counterparty's
301          * `to_self_delay` to reclaim funds.
302          * 
303          * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
304          * closing transaction which both sides find acceptable, ultimately paid by the channel
305          * funder/initiator.
306          * 
307          * When we are the funder, because we have to pay the channel closing fee, we bound the
308          * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by
309          * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
310          * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're
311          * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
312          * funds.
313          * 
314          * When we are not the funder, we require the closing transaction fee pay at least our
315          * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like.
316          * Thus, this value is ignored when we are not the funder.
317          * 
318          * Default value: 1000 satoshis.
319          * 
320          * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
321          * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
322          */
323         public void set_force_close_avoidance_max_fee_satoshis(long val) {
324                 bindings.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this.ptr, val);
325                 GC.KeepAlive(this);
326                 GC.KeepAlive(val);
327         }
328
329         /**
330          * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
331          * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
332          * 
333          * Usage:
334          * - The payee will set this option and set its invoice route hints to use [intercept scids]
335          * generated by this channel's counterparty.
336          * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
337          * [`forward_intercepted_htlc`] with less than the amount provided in
338          * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
339          * actual forward amounts is their fee. See
340          * <https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#flow-lsp-trusts-client-model>
341          * for how this feature may be used in the LSP use case.
342          * 
343          * # Note
344          * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
345          * as-expected if this feature is activated, otherwise they may lose money!
346          * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
347          * counterparty.
348          * 
349          * # Note
350          * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
351          * Unsetting this flag between restarts may lead to payment receive failures.
352          * 
353          * Default value: false.
354          * 
355          * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
356          * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
357          * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
358          * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
359          * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
360          * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
361          */
362         public bool get_accept_underpaying_htlcs() {
363                 bool ret = bindings.ChannelConfig_get_accept_underpaying_htlcs(this.ptr);
364                 GC.KeepAlive(this);
365                 return ret;
366         }
367
368         /**
369          * If set, allows this channel's counterparty to skim an additional fee off this node's inbound
370          * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
371          * 
372          * Usage:
373          * - The payee will set this option and set its invoice route hints to use [intercept scids]
374          * generated by this channel's counterparty.
375          * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
376          * [`forward_intercepted_htlc`] with less than the amount provided in
377          * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
378          * actual forward amounts is their fee. See
379          * <https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#flow-lsp-trusts-client-model>
380          * for how this feature may be used in the LSP use case.
381          * 
382          * # Note
383          * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
384          * as-expected if this feature is activated, otherwise they may lose money!
385          * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the
386          * counterparty.
387          * 
388          * # Note
389          * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116.
390          * Unsetting this flag between restarts may lead to payment receive failures.
391          * 
392          * Default value: false.
393          * 
394          * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
395          * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
396          * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
397          * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
398          * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
399          * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
400          */
401         public void set_accept_underpaying_htlcs(bool val) {
402                 bindings.ChannelConfig_set_accept_underpaying_htlcs(this.ptr, val);
403                 GC.KeepAlive(this);
404                 GC.KeepAlive(val);
405         }
406
407         /**
408          * Constructs a new ChannelConfig given each field
409          */
410         public static ChannelConfig of(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, org.ldk.structs.MaxDustHTLCExposure max_dust_htlc_exposure_arg, long force_close_avoidance_max_fee_satoshis_arg, bool accept_underpaying_htlcs_arg) {
411                 long ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_arg.ptr, force_close_avoidance_max_fee_satoshis_arg, accept_underpaying_htlcs_arg);
412                 GC.KeepAlive(forwarding_fee_proportional_millionths_arg);
413                 GC.KeepAlive(forwarding_fee_base_msat_arg);
414                 GC.KeepAlive(cltv_expiry_delta_arg);
415                 GC.KeepAlive(max_dust_htlc_exposure_arg);
416                 GC.KeepAlive(force_close_avoidance_max_fee_satoshis_arg);
417                 GC.KeepAlive(accept_underpaying_htlcs_arg);
418                 if (ret >= 0 && ret <= 4096) { return null; }
419                 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
420                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
421                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(max_dust_htlc_exposure_arg); };
422                 return ret_hu_conv;
423         }
424
425         internal long clone_ptr() {
426                 long ret = bindings.ChannelConfig_clone_ptr(this.ptr);
427                 GC.KeepAlive(this);
428                 return ret;
429         }
430
431         /**
432          * Creates a copy of the ChannelConfig
433          */
434         public ChannelConfig clone() {
435                 long ret = bindings.ChannelConfig_clone(this.ptr);
436                 GC.KeepAlive(this);
437                 if (ret >= 0 && ret <= 4096) { return null; }
438                 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
439                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
440                 return ret_hu_conv;
441         }
442
443         /**
444          * Checks if two ChannelConfigs contain equal inner contents.
445          * This ignores pointers and is_owned flags and looks at the values in fields.
446          * Two objects with NULL inner values will be considered "equal" here.
447          */
448         public bool eq(org.ldk.structs.ChannelConfig b) {
449                 bool ret = bindings.ChannelConfig_eq(this.ptr, b.ptr);
450                 GC.KeepAlive(this);
451                 GC.KeepAlive(b);
452                 if (this != null) { this.ptrs_to.AddLast(b); };
453                 return ret;
454         }
455
456         public override bool Equals(object o) {
457                 if (!(o is ChannelConfig)) return false;
458                 return this.eq((ChannelConfig)o);
459         }
460         /**
461          * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`].
462          */
463         public void apply(org.ldk.structs.ChannelConfigUpdate update) {
464                 bindings.ChannelConfig_apply(this.ptr, update.ptr);
465                 GC.KeepAlive(this);
466                 GC.KeepAlive(update);
467                 if (this != null) { this.ptrs_to.AddLast(update); };
468         }
469
470         /**
471          * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
472          */
473         public static ChannelConfig with_default() {
474                 long ret = bindings.ChannelConfig_default();
475                 if (ret >= 0 && ret <= 4096) { return null; }
476                 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
477                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
478                 return ret_hu_conv;
479         }
480
481         /**
482          * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
483          */
484         public byte[] write() {
485                 long ret = bindings.ChannelConfig_write(this.ptr);
486                 GC.KeepAlive(this);
487                 if (ret >= 0 && ret <= 4096) { return null; }
488                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
489                 return ret_conv;
490         }
491
492         /**
493          * Read a ChannelConfig from a byte array, created by ChannelConfig_write
494          */
495         public static Result_ChannelConfigDecodeErrorZ read(byte[] ser) {
496                 long ret = bindings.ChannelConfig_read(InternalUtils.encodeUint8Array(ser));
497                 GC.KeepAlive(ser);
498                 if (ret >= 0 && ret <= 4096) { return null; }
499                 Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret);
500                 return ret_hu_conv;
501         }
502
503 }
504 } } }