1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A parallel struct to [`ChannelConfig`] to define partial updates.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelConfigUpdate extends CommonBase {
16 ChannelConfigUpdate(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ChannelConfigUpdate_free(ptr); }
23 public Option_u32Z get_forwarding_fee_proportional_millionths() {
24 long ret = bindings.ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(this.ptr);
25 Reference.reachabilityFence(this);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
28 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
32 public void set_forwarding_fee_proportional_millionths(org.ldk.structs.Option_u32Z val) {
33 bindings.ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(this.ptr, val.ptr);
34 Reference.reachabilityFence(this);
35 Reference.reachabilityFence(val);
36 if (this != null) { this.ptrs_to.add(val); };
39 public Option_u32Z get_forwarding_fee_base_msat() {
40 long ret = bindings.ChannelConfigUpdate_get_forwarding_fee_base_msat(this.ptr);
41 Reference.reachabilityFence(this);
42 if (ret >= 0 && ret <= 4096) { return null; }
43 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
44 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
48 public void set_forwarding_fee_base_msat(org.ldk.structs.Option_u32Z val) {
49 bindings.ChannelConfigUpdate_set_forwarding_fee_base_msat(this.ptr, val.ptr);
50 Reference.reachabilityFence(this);
51 Reference.reachabilityFence(val);
52 if (this != null) { this.ptrs_to.add(val); };
55 public Option_u16Z get_cltv_expiry_delta() {
56 long ret = bindings.ChannelConfigUpdate_get_cltv_expiry_delta(this.ptr);
57 Reference.reachabilityFence(this);
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret);
60 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
64 public void set_cltv_expiry_delta(org.ldk.structs.Option_u16Z val) {
65 bindings.ChannelConfigUpdate_set_cltv_expiry_delta(this.ptr, val.ptr);
66 Reference.reachabilityFence(this);
67 Reference.reachabilityFence(val);
68 if (this != null) { this.ptrs_to.add(val); };
72 * Returns a copy of the field.
74 public Option_MaxDustHTLCExposureZ get_max_dust_htlc_exposure_msat() {
75 long ret = bindings.ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(this.ptr);
76 Reference.reachabilityFence(this);
77 if (ret >= 0 && ret <= 4096) { return null; }
78 org.ldk.structs.Option_MaxDustHTLCExposureZ ret_hu_conv = org.ldk.structs.Option_MaxDustHTLCExposureZ.constr_from_ptr(ret);
79 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
83 public void set_max_dust_htlc_exposure_msat(org.ldk.structs.Option_MaxDustHTLCExposureZ val) {
84 bindings.ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(this.ptr, val.ptr);
85 Reference.reachabilityFence(this);
86 Reference.reachabilityFence(val);
87 if (this != null) { this.ptrs_to.add(val); };
90 public Option_u64Z get_force_close_avoidance_max_fee_satoshis() {
91 long ret = bindings.ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(this.ptr);
92 Reference.reachabilityFence(this);
93 if (ret >= 0 && ret <= 4096) { return null; }
94 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
95 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
99 public void set_force_close_avoidance_max_fee_satoshis(org.ldk.structs.Option_u64Z val) {
100 bindings.ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(this.ptr, val.ptr);
101 Reference.reachabilityFence(this);
102 Reference.reachabilityFence(val);
103 if (this != null) { this.ptrs_to.add(val); };
107 * Constructs a new ChannelConfigUpdate given each field
109 public static ChannelConfigUpdate of(org.ldk.structs.Option_u32Z forwarding_fee_proportional_millionths_arg, org.ldk.structs.Option_u32Z forwarding_fee_base_msat_arg, org.ldk.structs.Option_u16Z cltv_expiry_delta_arg, org.ldk.structs.Option_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg, org.ldk.structs.Option_u64Z force_close_avoidance_max_fee_satoshis_arg) {
110 long ret = bindings.ChannelConfigUpdate_new(forwarding_fee_proportional_millionths_arg.ptr, forwarding_fee_base_msat_arg.ptr, cltv_expiry_delta_arg.ptr, max_dust_htlc_exposure_msat_arg.ptr, force_close_avoidance_max_fee_satoshis_arg.ptr);
111 Reference.reachabilityFence(forwarding_fee_proportional_millionths_arg);
112 Reference.reachabilityFence(forwarding_fee_base_msat_arg);
113 Reference.reachabilityFence(cltv_expiry_delta_arg);
114 Reference.reachabilityFence(max_dust_htlc_exposure_msat_arg);
115 Reference.reachabilityFence(force_close_avoidance_max_fee_satoshis_arg);
116 if (ret >= 0 && ret <= 4096) { return null; }
117 org.ldk.structs.ChannelConfigUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfigUpdate(null, ret); }
118 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
119 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(forwarding_fee_proportional_millionths_arg); };
120 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(forwarding_fee_base_msat_arg); };
121 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(cltv_expiry_delta_arg); };
122 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(max_dust_htlc_exposure_msat_arg); };
123 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(force_close_avoidance_max_fee_satoshis_arg); };
128 * Creates a "default" ChannelConfigUpdate. See struct and individual field documentaiton for details on which values are used.
130 public static ChannelConfigUpdate with_default() {
131 long ret = bindings.ChannelConfigUpdate_default();
132 if (ret >= 0 && ret <= 4096) { return null; }
133 org.ldk.structs.ChannelConfigUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfigUpdate(null, ret); }
134 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };