Trimmed HTLC
A trimmed HTLC is a forwarded payment too small to justify an on-chain output, so its value is added to the commitment fee.
Key Takeaways
- A trimmed HTLC is an in-flight Lightning payment whose on-chain value falls below the dust threshold, making it uneconomical to enforce on-chain. Its value is added to the commitment transaction fee instead of receiving its own output.
- Trimming enables micropayments: without it, the minimum payment a Lightning channel could forward would be the dust limit plus the cost of claiming the HTLC on-chain, shutting out small-value transfers entirely.
- The tradeoff is real risk: if a channel force-closes while trimmed HTLCs are pending, their combined value is permanently lost to miner fees rather than returned to either party.
What Is a Trimmed HTLC?
A trimmed HTLC is a hash time-locked contract whose value is too small to justify creating a separate output in the commitment transaction. Every in-flight Lightning payment is represented as an HTLC output on each side's commitment transaction. If a channel force-closes, those outputs need to be claimed on-chain through second-stage transactions that cost fees themselves. When the HTLC amount is less than the cost of claiming it, creating the output would be economically irrational: the miner fee to spend it would exceed its value.
Rather than blocking small payments entirely, the Lightning protocol trims these uneconomical HTLCs. Instead of adding a dedicated output to the commitment transaction, the HTLC's value is folded into the transaction's fee. During normal channel operation, this has no practical impact: the HTLC resolves off-chain through preimage exchange or timeout, and both parties settle correctly. The trimming only matters if a force close occurs while the HTLC is still pending.
The concept is defined in BOLT 3, which specifies how commitment transactions are constructed. A payment that is trimmed in one channel may not be trimmed in another, because different channels have different dust limits and feerates.
How It Works
When two nodes update their commitment transaction to reflect a new in-flight payment, they evaluate whether each HTLC should receive its own output or be trimmed. The decision follows a specific formula defined in the Lightning specification.
The Trimming Threshold
An HTLC is trimmed if its value falls below the channel owner's dust_limit_satoshis plus the fee required to claim it via a second-stage transaction. The second-stage fee depends on the commitment transaction's negotiated feerate and the weight of the claiming transaction (either an HTLC-success or HTLC-timeout transaction).
In simplified terms:
trim_threshold = dust_limit_satoshis
+ (htlc_claim_tx_weight * feerate_per_kw / 1000)
// For offered HTLCs (HTLC-timeout transaction):
// htlc_claim_tx_weight = 663 weight units
// For received HTLCs (HTLC-success transaction):
// htlc_claim_tx_weight = 703 weight units
// Example at feerate 10 sat/vbyte (2500 sat/kw):
// dust_limit = 546 sats
// timeout_fee = 663 * 2500 / 1000 = 1657 sats
// trim_threshold = 546 + 1657 = 2203 sats
// Any HTLC below 2203 sats would be trimmedBecause the threshold depends on the current feerate, rising on-chain fees push the trim boundary higher. An HTLC that was economical at 5 sat/vbyte might be trimmed at 50 sat/vbyte. The trim decision is re-evaluated each time the commitment transaction is updated, not once per HTLC.
Anchor Channels Change the Calculation
With anchor outputs (specifically option_anchors_zero_fee_htlc_tx), second-stage HTLC transactions use a zero feerate and are fee-bumped separately via CPFP. This means the trim threshold simplifies to just the static dust_limit_satoshis:
// Anchor channels (zero-fee HTLC transactions):
trim_threshold = dust_limit_satoshis
// With dust_limit = 546 sats:
// Only HTLCs below 546 sats are trimmedThis significantly reduces the amount of value at risk from trimming, because the threshold no longer scales with on-chain feerates.
What Happens During a Force Close
When a channel publishes its commitment transaction on-chain:
- Non-trimmed HTLCs appear as separate outputs that can be claimed through HTLC-success or HTLC-timeout transactions
- Trimmed HTLCs have no output: their value was added to the commitment transaction fee
- The miner who includes the commitment transaction in a block collects the inflated fee, which includes the trimmed HTLC value
- Neither the sender nor the receiver can recover the trimmed amount
Why It Matters
Trimmed HTLCs represent a deliberate design tradeoff in the Lightning Network. Without the ability to trim, channels would need to enforce a minimum payment size equal to the economic dust threshold. At moderate feerates, this could block payments below several thousand satoshis, undermining Lightning's value proposition for micropayments.
The tradeoff is that small in-flight payments carry a risk that does not exist for larger ones: if a force close occurs at the wrong moment, the value is lost. For most users, the probability of a force close during the brief window an HTLC is in flight is low enough that the risk is acceptable. But the aggregate exposure across many trimmed HTLCs can become significant.
Layer-2 protocols like Spark avoid this issue entirely by using a different architecture. Spark transfers ownership of virtual UTXOs via statechains rather than routing payments through HTLC-based channels, eliminating the need for dust-threshold calculations on in-flight payments.
Use Cases
Trimmed HTLCs are not a feature users choose to enable: they are an automatic consequence of sending payments below the economic threshold. They appear naturally in several contexts:
- Micropayments and tipping: payments of a few hundred satoshis are commonly trimmed, especially during periods of high on-chain fees
- Streaming payments: pay-per-second or pay-per-kilobyte models send many tiny increments, most of which fall below the trim threshold
- Gaming and content monetization: in-app purchases measured in single satoshis or small millisatoshi amounts are trimmed in every channel they traverse
- Multi-path payments: when a payment is split across many routes, some shards may be small enough to be trimmed in certain channels along the path
Risks and Considerations
Value Destruction on Force Close
The primary risk is straightforward: trimmed HTLC value is permanently lost if a force close occurs. While any single trimmed HTLC may represent a trivial amount, a node routing many small payments simultaneously can accumulate a meaningful total. If multiple trimmed HTLCs are pending when the commitment transaction goes on-chain, all of their combined value goes to miners.
Griefing via Dust Exposure
A malicious counterparty can exploit trimmed HTLCs to deliberately destroy channel funds. The attack works by sending many small HTLCs that all fall below the trim threshold, then forcing the channel closed. The attacker loses their own trimmed HTLCs but also burns the victim's inbound trimmed HTLCs: a form of griefing where the cost to the attacker is comparable to the damage inflicted.
To mitigate this, implementations enforce a max_dust_htlc_exposure limit: the maximum total value of trimmed HTLCs allowed in a single commitment transaction. If accepting a new HTLC would push the aggregate trimmed value above this limit, the HTLC is rejected. LDK, for example, defaults to a max_dust_htlc_exposure of 50,000 satoshis as a configurable safety bound.
Feerate Manipulation
In non-anchor channels, the channel funder controls the commitment feerate via update_fee messages. Raising the feerate increases the trim threshold, potentially converting previously non-trimmed HTLCs into trimmed ones. A malicious funder could spike the feerate just before forcing a channel close, maximizing the value lost to trimming.
Anchor output channels mitigate this by decoupling the HTLC claim fee from the commitment feerate. With option_anchors_zero_fee_htlc_tx, the trim threshold uses only the static dust limit, removing the feerate manipulation vector.
Proposed Improvements
Several proposals aim to reduce trimmed HTLC risk further:
- Fee-dependent dust buffer: implementations can define a
dust_buffer_feerate(the greater of 2530 sat/kW or 125% of the current feerate) to build headroom against sudden feerate spikes - OP_RETURN outputs: instead of adding trimmed value to fees, the commitment transaction could include a provably unspendable output, reducing miner incentive to trigger force closes
- PTLCs and probabilistic payments: replacing many small payments with fewer, larger ones would reduce the frequency of below-dust amounts
For a deeper look at how Lightning handles fee-related tradeoffs, see the research article on Bitcoin fee market dynamics and the Lightning Network scalability limits.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.