6 namespace org { namespace ldk { namespace structs {
10 * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
12 * Default::default() provides sane defaults for most configurations
13 * (but currently with 0 relay fees!)
15 public class UserConfig : CommonBase {
16 internal UserConfig(object _dummy, long ptr) : base(ptr) { }
18 if (ptr != 0) { bindings.UserConfig_free(ptr); }
22 * Channel handshake config that we propose to our counterparty.
24 public ChannelHandshakeConfig get_channel_handshake_config() {
25 long ret = bindings.UserConfig_get_channel_handshake_config(this.ptr);
27 if (ret >= 0 && ret <= 4096) { return null; }
28 org.ldk.structs.ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeConfig(null, ret); }
29 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
34 * Channel handshake config that we propose to our counterparty.
36 public void set_channel_handshake_config(org.ldk.structs.ChannelHandshakeConfig val) {
37 bindings.UserConfig_set_channel_handshake_config(this.ptr, val == null ? 0 : val.ptr);
40 if (this != null) { this.ptrs_to.AddLast(val); };
44 * Limits applied to our counterparty's proposed channel handshake config settings.
46 public ChannelHandshakeLimits get_channel_handshake_limits() {
47 long ret = bindings.UserConfig_get_channel_handshake_limits(this.ptr);
49 if (ret >= 0 && ret <= 4096) { return null; }
50 org.ldk.structs.ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeLimits(null, ret); }
51 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
56 * Limits applied to our counterparty's proposed channel handshake config settings.
58 public void set_channel_handshake_limits(org.ldk.structs.ChannelHandshakeLimits val) {
59 bindings.UserConfig_set_channel_handshake_limits(this.ptr, val == null ? 0 : val.ptr);
62 if (this != null) { this.ptrs_to.AddLast(val); };
66 * Channel config which affects behavior during channel lifetime.
68 public ChannelConfig get_channel_config() {
69 long ret = bindings.UserConfig_get_channel_config(this.ptr);
71 if (ret >= 0 && ret <= 4096) { return null; }
72 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
78 * Channel config which affects behavior during channel lifetime.
80 public void set_channel_config(org.ldk.structs.ChannelConfig val) {
81 bindings.UserConfig_set_channel_config(this.ptr, val == null ? 0 : val.ptr);
84 if (this != null) { this.ptrs_to.AddLast(val); };
88 * If this is set to false, we will reject any HTLCs which were to be forwarded over private
89 * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
90 * node which is not online reliably.
92 * For nodes which are not online reliably, you should set all channels to *not* be announced
93 * (using [`ChannelHandshakeConfig::announced_channel`] and
94 * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
95 * ensure you are not exposed to any forwarding risk.
97 * Note that because you cannot change a channel's announced state after creation, there is no
98 * way to disable forwarding on public channels retroactively. Thus, in order to change a node
99 * from a publicly-announced forwarding node to a private non-forwarding node you must close
100 * all your channels and open new ones. For privacy, you should also change your node_id
101 * (swapping all private and public key material for new ones) at that time.
103 * Default value: false.
105 public bool get_accept_forwards_to_priv_channels() {
106 bool ret = bindings.UserConfig_get_accept_forwards_to_priv_channels(this.ptr);
112 * If this is set to false, we will reject any HTLCs which were to be forwarded over private
113 * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
114 * node which is not online reliably.
116 * For nodes which are not online reliably, you should set all channels to *not* be announced
117 * (using [`ChannelHandshakeConfig::announced_channel`] and
118 * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
119 * ensure you are not exposed to any forwarding risk.
121 * Note that because you cannot change a channel's announced state after creation, there is no
122 * way to disable forwarding on public channels retroactively. Thus, in order to change a node
123 * from a publicly-announced forwarding node to a private non-forwarding node you must close
124 * all your channels and open new ones. For privacy, you should also change your node_id
125 * (swapping all private and public key material for new ones) at that time.
127 * Default value: false.
129 public void set_accept_forwards_to_priv_channels(bool val) {
130 bindings.UserConfig_set_accept_forwards_to_priv_channels(this.ptr, val);
136 * If this is set to false, we do not accept inbound requests to open a new channel.
137 * Default value: true.
139 public bool get_accept_inbound_channels() {
140 bool ret = bindings.UserConfig_get_accept_inbound_channels(this.ptr);
146 * If this is set to false, we do not accept inbound requests to open a new channel.
147 * Default value: true.
149 public void set_accept_inbound_channels(bool val) {
150 bindings.UserConfig_set_accept_inbound_channels(this.ptr, val);
156 * If this is set to true, the user needs to manually accept inbound requests to open a new
159 * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
160 * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
161 * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
162 * user explicitly chooses to accept the request.
164 * Default value: false.
166 * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
167 * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
168 * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
170 public bool get_manually_accept_inbound_channels() {
171 bool ret = bindings.UserConfig_get_manually_accept_inbound_channels(this.ptr);
177 * If this is set to true, the user needs to manually accept inbound requests to open a new
180 * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
181 * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
182 * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
183 * user explicitly chooses to accept the request.
185 * Default value: false.
187 * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
188 * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
189 * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
191 public void set_manually_accept_inbound_channels(bool val) {
192 bindings.UserConfig_set_manually_accept_inbound_channels(this.ptr, val);
198 * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
199 * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
200 * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
202 * Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
204 * Default value: false.
206 * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
207 * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
209 public bool get_accept_intercept_htlcs() {
210 bool ret = bindings.UserConfig_get_accept_intercept_htlcs(this.ptr);
216 * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
217 * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
218 * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
220 * Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
222 * Default value: false.
224 * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
225 * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
227 public void set_accept_intercept_htlcs(bool val) {
228 bindings.UserConfig_set_accept_intercept_htlcs(this.ptr, val);
234 * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
235 * parts. If this is set to true, we'll accept the payment.
237 * Setting this to true will break backwards compatibility upon downgrading to an LDK
238 * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
239 * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
241 * Default value: false.
243 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
245 public bool get_accept_mpp_keysend() {
246 bool ret = bindings.UserConfig_get_accept_mpp_keysend(this.ptr);
252 * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple
253 * parts. If this is set to true, we'll accept the payment.
255 * Setting this to true will break backwards compatibility upon downgrading to an LDK
256 * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP
257 * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`].
259 * Default value: false.
261 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
263 public void set_accept_mpp_keysend(bool val) {
264 bindings.UserConfig_set_accept_mpp_keysend(this.ptr, val);
270 * Constructs a new UserConfig given each field
272 public static UserConfig of(org.ldk.structs.ChannelHandshakeConfig channel_handshake_config_arg, org.ldk.structs.ChannelHandshakeLimits channel_handshake_limits_arg, org.ldk.structs.ChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg, bool accept_intercept_htlcs_arg, bool accept_mpp_keysend_arg) {
273 long ret = bindings.UserConfig_new(channel_handshake_config_arg == null ? 0 : channel_handshake_config_arg.ptr, channel_handshake_limits_arg == null ? 0 : channel_handshake_limits_arg.ptr, channel_config_arg == null ? 0 : channel_config_arg.ptr, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg, accept_mpp_keysend_arg);
274 GC.KeepAlive(channel_handshake_config_arg);
275 GC.KeepAlive(channel_handshake_limits_arg);
276 GC.KeepAlive(channel_config_arg);
277 GC.KeepAlive(accept_forwards_to_priv_channels_arg);
278 GC.KeepAlive(accept_inbound_channels_arg);
279 GC.KeepAlive(manually_accept_inbound_channels_arg);
280 GC.KeepAlive(accept_intercept_htlcs_arg);
281 GC.KeepAlive(accept_mpp_keysend_arg);
282 if (ret >= 0 && ret <= 4096) { return null; }
283 org.ldk.structs.UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UserConfig(null, ret); }
284 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
285 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_handshake_config_arg); };
286 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_handshake_limits_arg); };
287 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_config_arg); };
291 internal long clone_ptr() {
292 long ret = bindings.UserConfig_clone_ptr(this.ptr);
298 * Creates a copy of the UserConfig
300 public UserConfig clone() {
301 long ret = bindings.UserConfig_clone(this.ptr);
303 if (ret >= 0 && ret <= 4096) { return null; }
304 org.ldk.structs.UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UserConfig(null, ret); }
305 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
310 * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
312 public static UserConfig with_default() {
313 long ret = bindings.UserConfig_default();
314 if (ret >= 0 && ret <= 4096) { return null; }
315 org.ldk.structs.UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UserConfig(null, ret); }
316 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };