Skip to content

Commit 53b6823

Browse files
author
Antoine Riard
committed
Add new config setting max_balance_dust_htlc_msat
Trimmed-to-dust HTLCs are at risk of being burnt as miner fees at anytime during their lifetime due to the broadcast of either holder commitment transaction or counterparty's one. To hedge against this risk, we introduce a new config setting `max_balance_dust_htlc_msat`, with the initial value of 5_000_000 msat.
1 parent 01bdc15 commit 53b6823

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lightning/src/util/config.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,23 @@ pub struct ChannelConfig {
206206
/// This cannot be changed after a channel has been initialized.
207207
///
208208
/// Default value: true.
209-
pub commit_upfront_shutdown_pubkey: bool
209+
pub commit_upfront_shutdown_pubkey: bool,
210+
/// Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
211+
/// small to claim on-chain.
212+
///
213+
/// When an HTLC present in one of our channels is below a "dust" threshold, the HTLC will
214+
/// not be claimable on-chain, instead being turned into additional miner fees if either
215+
/// party force-closes the channel. Because the threshold is per-HTLC, our total exposure
216+
/// to such payments may be sustantial if there are many dust HTLCs present when the
217+
/// channel is force-closed.
218+
///
219+
/// This limit is applied for sent, forwarded, and received HTLCs and limits the total
220+
/// exposure across all three types per-channel. Setting this too low may prevent the
221+
/// sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
222+
/// important to prevent stealing of dust HTLCs by miners.
223+
///
224+
/// Default value: 5_000_000 msat.
225+
pub max_dust_htlc_exposure_msat: u64,
210226
}
211227

212228
impl Default for ChannelConfig {
@@ -218,12 +234,14 @@ impl Default for ChannelConfig {
218234
cltv_expiry_delta: 6 * 12, // 6 blocks/hour * 12 hours
219235
announced_channel: false,
220236
commit_upfront_shutdown_pubkey: true,
237+
max_dust_htlc_exposure_msat: 5_000_000,
221238
}
222239
}
223240
}
224241

225242
impl_writeable_tlv_based!(ChannelConfig, {
226243
(0, forwarding_fee_proportional_millionths, required),
244+
(1, max_dust_htlc_exposure_msat, (default_value, 5_000_000)),
227245
(2, cltv_expiry_delta, required),
228246
(4, announced_channel, required),
229247
(6, commit_upfront_shutdown_pubkey, required),

0 commit comments

Comments
 (0)