@@ -203,11 +203,111 @@ public void set_commit_upfront_shutdown_pubkey(boolean val) {
203203 bindings .ChannelConfig_set_commit_upfront_shutdown_pubkey (this .ptr , val );
204204 }
205205
206+ /**
207+ * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
208+ * small to claim on-chain.
209+ *
210+ * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
211+ * not be claimable on-chain, instead being turned into additional miner fees if either
212+ * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
213+ * to such payments may be sustantial if there are many dust HTLCs present when the
214+ * channel is force-closed.
215+ *
216+ * This limit is applied for sent, forwarded, and received HTLCs and limits the total
217+ * exposure across all three types per-channel. Setting this too low may prevent the
218+ * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
219+ * important to prevent stealing of dust HTLCs by miners.
220+ *
221+ * Default value: 5_000_000 msat.
222+ */
223+ public long get_max_dust_htlc_exposure_msat () {
224+ long ret = bindings .ChannelConfig_get_max_dust_htlc_exposure_msat (this .ptr );
225+ return ret ;
226+ }
227+
228+ /**
229+ * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
230+ * small to claim on-chain.
231+ *
232+ * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
233+ * not be claimable on-chain, instead being turned into additional miner fees if either
234+ * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
235+ * to such payments may be sustantial if there are many dust HTLCs present when the
236+ * channel is force-closed.
237+ *
238+ * This limit is applied for sent, forwarded, and received HTLCs and limits the total
239+ * exposure across all three types per-channel. Setting this too low may prevent the
240+ * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
241+ * important to prevent stealing of dust HTLCs by miners.
242+ *
243+ * Default value: 5_000_000 msat.
244+ */
245+ public void set_max_dust_htlc_exposure_msat (long val ) {
246+ bindings .ChannelConfig_set_max_dust_htlc_exposure_msat (this .ptr , val );
247+ }
248+
249+ /**
250+ * The additional fee we're willing to pay to avoid waiting for the counterparty's
251+ * `to_self_delay` to reclaim funds.
252+ *
253+ * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
254+ * closing transaction which both sides find acceptable, ultimately paid by the channel
255+ * funder/initiator.
256+ *
257+ * When we are the funder, because we have to pay the channel closing fee, we bound the
258+ * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
259+ * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
260+ * [`Normal`] feerate during normal operation, this value represents the additional fee we're
261+ * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
262+ * funds.
263+ *
264+ * When we are not the funder, we require the closing transaction fee pay at least our
265+ * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
266+ * Thus, this value is ignored when we are not the funder.
267+ *
268+ * Default value: 1000 satoshis.
269+ *
270+ * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
271+ * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
272+ */
273+ public long get_force_close_avoidance_max_fee_satoshis () {
274+ long ret = bindings .ChannelConfig_get_force_close_avoidance_max_fee_satoshis (this .ptr );
275+ return ret ;
276+ }
277+
278+ /**
279+ * The additional fee we're willing to pay to avoid waiting for the counterparty's
280+ * `to_self_delay` to reclaim funds.
281+ *
282+ * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
283+ * closing transaction which both sides find acceptable, ultimately paid by the channel
284+ * funder/initiator.
285+ *
286+ * When we are the funder, because we have to pay the channel closing fee, we bound the
287+ * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
288+ * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
289+ * [`Normal`] feerate during normal operation, this value represents the additional fee we're
290+ * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
291+ * funds.
292+ *
293+ * When we are not the funder, we require the closing transaction fee pay at least our
294+ * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
295+ * Thus, this value is ignored when we are not the funder.
296+ *
297+ * Default value: 1000 satoshis.
298+ *
299+ * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
300+ * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
301+ */
302+ public void set_force_close_avoidance_max_fee_satoshis (long val ) {
303+ bindings .ChannelConfig_set_force_close_avoidance_max_fee_satoshis (this .ptr , val );
304+ }
305+
206306 /**
207307 * Constructs a new ChannelConfig given each field
208308 */
209- public static ChannelConfig of (int forwarding_fee_proportional_millionths_arg , int forwarding_fee_base_msat_arg , short cltv_expiry_delta_arg , boolean announced_channel_arg , boolean commit_upfront_shutdown_pubkey_arg ) {
210- long ret = bindings .ChannelConfig_new (forwarding_fee_proportional_millionths_arg , forwarding_fee_base_msat_arg , cltv_expiry_delta_arg , announced_channel_arg , commit_upfront_shutdown_pubkey_arg );
309+ public static ChannelConfig of (int forwarding_fee_proportional_millionths_arg , int forwarding_fee_base_msat_arg , short cltv_expiry_delta_arg , boolean announced_channel_arg , boolean commit_upfront_shutdown_pubkey_arg , long max_dust_htlc_exposure_msat_arg , long force_close_avoidance_max_fee_satoshis_arg ) {
310+ long ret = bindings .ChannelConfig_new (forwarding_fee_proportional_millionths_arg , forwarding_fee_base_msat_arg , cltv_expiry_delta_arg , announced_channel_arg , commit_upfront_shutdown_pubkey_arg , max_dust_htlc_exposure_msat_arg , force_close_avoidance_max_fee_satoshis_arg );
211311 if (ret < 1024 ) { return null ; }
212312 ChannelConfig ret_hu_conv = new ChannelConfig (null , ret );
213313 ret_hu_conv .ptrs_to .add (ret_hu_conv );
0 commit comments