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