6 namespace org { namespace ldk { namespace structs {
10 * Optional channel limits which are applied during channel creation.
12 * These limits are only applied to our counterparty's limits, not our own.
14 * Use 0/<type>::max_value() as appropriate to skip checking.
16 * Provides sane defaults for most configurations.
18 * Most additional limits are disabled except those with which specify a default in individual
19 * field documentation. Note that this may result in barely-usable channels, but since they
20 * are applied mostly only to incoming channels that's not much of a problem.
22 public class ChannelHandshakeLimits : CommonBase {
23 internal ChannelHandshakeLimits(object _dummy, long ptr) : base(ptr) { }
24 ~ChannelHandshakeLimits() {
25 if (ptr != 0) { bindings.ChannelHandshakeLimits_free(ptr); }
29 * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
30 * only applies to inbound channels.
34 public long get_min_funding_satoshis() {
35 long ret = bindings.ChannelHandshakeLimits_get_min_funding_satoshis(this.ptr);
41 * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
42 * only applies to inbound channels.
46 public void set_min_funding_satoshis(long val) {
47 bindings.ChannelHandshakeLimits_set_min_funding_satoshis(this.ptr, val);
53 * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
54 * only applies to inbound channels.
56 * Default value: 2^24 - 1.
58 public long get_max_funding_satoshis() {
59 long ret = bindings.ChannelHandshakeLimits_get_max_funding_satoshis(this.ptr);
65 * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
66 * only applies to inbound channels.
68 * Default value: 2^24 - 1.
70 public void set_max_funding_satoshis(long val) {
71 bindings.ChannelHandshakeLimits_set_max_funding_satoshis(this.ptr, val);
77 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
78 * you to limit the maximum minimum-size they can require.
80 * Default value: u64::max_value.
82 public long get_max_htlc_minimum_msat() {
83 long ret = bindings.ChannelHandshakeLimits_get_max_htlc_minimum_msat(this.ptr);
89 * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
90 * you to limit the maximum minimum-size they can require.
92 * Default value: u64::max_value.
94 public void set_max_htlc_minimum_msat(long val) {
95 bindings.ChannelHandshakeLimits_set_max_htlc_minimum_msat(this.ptr, val);
101 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
102 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
106 public long get_min_max_htlc_value_in_flight_msat() {
107 long ret = bindings.ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this.ptr);
113 * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
114 * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
118 public void set_min_max_htlc_value_in_flight_msat(long val) {
119 bindings.ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this.ptr, val);
125 * The remote node will require we keep a certain amount in direct payment to ourselves at all
126 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
127 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
129 * Default value: u64::max_value.
131 public long get_max_channel_reserve_satoshis() {
132 long ret = bindings.ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this.ptr);
138 * The remote node will require we keep a certain amount in direct payment to ourselves at all
139 * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
140 * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
142 * Default value: u64::max_value.
144 public void set_max_channel_reserve_satoshis(long val) {
145 bindings.ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this.ptr, val);
151 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
152 * time. This allows you to set a minimum such value.
156 public short get_min_max_accepted_htlcs() {
157 short ret = bindings.ChannelHandshakeLimits_get_min_max_accepted_htlcs(this.ptr);
163 * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
164 * time. This allows you to set a minimum such value.
168 public void set_min_max_accepted_htlcs(short val) {
169 bindings.ChannelHandshakeLimits_set_min_max_accepted_htlcs(this.ptr, val);
175 * Before a channel is usable the funding transaction will need to be confirmed by at least a
176 * certain number of blocks, specified by the node which is not the funder (as the funder can
177 * assume they aren't going to double-spend themselves).
178 * This config allows you to set a limit on the maximum amount of time to wait.
180 * Default value: 144, or roughly one day and only applies to outbound channels.
182 public int get_max_minimum_depth() {
183 int ret = bindings.ChannelHandshakeLimits_get_max_minimum_depth(this.ptr);
189 * Before a channel is usable the funding transaction will need to be confirmed by at least a
190 * certain number of blocks, specified by the node which is not the funder (as the funder can
191 * assume they aren't going to double-spend themselves).
192 * This config allows you to set a limit on the maximum amount of time to wait.
194 * Default value: 144, or roughly one day and only applies to outbound channels.
196 public void set_max_minimum_depth(int val) {
197 bindings.ChannelHandshakeLimits_set_max_minimum_depth(this.ptr, val);
203 * Whether we implicitly trust funding transactions generated by us for our own outbound
204 * channels to not be double-spent.
206 * If this is set, we assume that our own funding transactions are *never* double-spent, and
207 * thus we can trust them without any confirmations. This is generally a reasonable
208 * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
209 * control of the signing keys).
211 * You may wish to un-set this if you allow the user to (or do in an automated fashion)
212 * double-spend the funding transaction to RBF with an alternative channel open.
214 * This only applies if our counterparty set their confirmations-required value to 0, and we
215 * always trust our own funding transaction at 1 confirmation irrespective of this value.
216 * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
217 * `true` (0) and `false` (1).
219 * Default value: true
221 public bool get_trust_own_funding_0conf() {
222 bool ret = bindings.ChannelHandshakeLimits_get_trust_own_funding_0conf(this.ptr);
228 * Whether we implicitly trust funding transactions generated by us for our own outbound
229 * channels to not be double-spent.
231 * If this is set, we assume that our own funding transactions are *never* double-spent, and
232 * thus we can trust them without any confirmations. This is generally a reasonable
233 * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
234 * control of the signing keys).
236 * You may wish to un-set this if you allow the user to (or do in an automated fashion)
237 * double-spend the funding transaction to RBF with an alternative channel open.
239 * This only applies if our counterparty set their confirmations-required value to 0, and we
240 * always trust our own funding transaction at 1 confirmation irrespective of this value.
241 * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
242 * `true` (0) and `false` (1).
244 * Default value: true
246 public void set_trust_own_funding_0conf(bool val) {
247 bindings.ChannelHandshakeLimits_set_trust_own_funding_0conf(this.ptr, val);
253 * Set to force an incoming channel to match our announced channel preference in
254 * [`ChannelHandshakeConfig::announced_channel`].
256 * For a node which is not online reliably, this should be set to true and
257 * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
258 * channels will ever be opened.
260 * Default value: true.
262 public bool get_force_announced_channel_preference() {
263 bool ret = bindings.ChannelHandshakeLimits_get_force_announced_channel_preference(this.ptr);
269 * Set to force an incoming channel to match our announced channel preference in
270 * [`ChannelHandshakeConfig::announced_channel`].
272 * For a node which is not online reliably, this should be set to true and
273 * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
274 * channels will ever be opened.
276 * Default value: true.
278 public void set_force_announced_channel_preference(bool val) {
279 bindings.ChannelHandshakeLimits_set_force_announced_channel_preference(this.ptr, val);
285 * Set to the amount of time we're willing to wait to claim money back to us.
287 * Not checking this value would be a security issue, as our peer would be able to set it to
288 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
290 * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
291 * reduce the loss of having useless locked funds (if your peer accepts)
293 public short get_their_to_self_delay() {
294 short ret = bindings.ChannelHandshakeLimits_get_their_to_self_delay(this.ptr);
300 * Set to the amount of time we're willing to wait to claim money back to us.
302 * Not checking this value would be a security issue, as our peer would be able to set it to
303 * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
305 * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
306 * reduce the loss of having useless locked funds (if your peer accepts)
308 public void set_their_to_self_delay(short val) {
309 bindings.ChannelHandshakeLimits_set_their_to_self_delay(this.ptr, val);
315 * Constructs a new ChannelHandshakeLimits given each field
317 public static ChannelHandshakeLimits of(long min_funding_satoshis_arg, long max_funding_satoshis_arg, long max_htlc_minimum_msat_arg, long min_max_htlc_value_in_flight_msat_arg, long max_channel_reserve_satoshis_arg, short min_max_accepted_htlcs_arg, int max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, short their_to_self_delay_arg) {
318 long ret = bindings.ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, max_minimum_depth_arg, trust_own_funding_0conf_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
319 GC.KeepAlive(min_funding_satoshis_arg);
320 GC.KeepAlive(max_funding_satoshis_arg);
321 GC.KeepAlive(max_htlc_minimum_msat_arg);
322 GC.KeepAlive(min_max_htlc_value_in_flight_msat_arg);
323 GC.KeepAlive(max_channel_reserve_satoshis_arg);
324 GC.KeepAlive(min_max_accepted_htlcs_arg);
325 GC.KeepAlive(max_minimum_depth_arg);
326 GC.KeepAlive(trust_own_funding_0conf_arg);
327 GC.KeepAlive(force_announced_channel_preference_arg);
328 GC.KeepAlive(their_to_self_delay_arg);
329 if (ret >= 0 && ret <= 4096) { return null; }
330 org.ldk.structs.ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeLimits(null, ret); }
331 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
335 internal long clone_ptr() {
336 long ret = bindings.ChannelHandshakeLimits_clone_ptr(this.ptr);
342 * Creates a copy of the ChannelHandshakeLimits
344 public ChannelHandshakeLimits clone() {
345 long ret = bindings.ChannelHandshakeLimits_clone(this.ptr);
347 if (ret >= 0 && ret <= 4096) { return null; }
348 org.ldk.structs.ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeLimits(null, ret); }
349 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
354 * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
356 public static ChannelHandshakeLimits with_default() {
357 long ret = bindings.ChannelHandshakeLimits_default();
358 if (ret >= 0 && ret <= 4096) { return null; }
359 org.ldk.structs.ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelHandshakeLimits(null, ret); }
360 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };