Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions 02-peer-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ The sending node SHOULD:
- set `to_self_delay` sufficient to ensure the sender can irreversibly spend a commitment transaction output, in case of misbehavior by the receiver.
- set `feerate_per_kw` to at least the rate it estimates would cause the transaction to be immediately included in a block.
- set `dust_limit_satoshis` to a sufficient value to allow commitment transactions to propagate through the Bitcoin network.
- set `dust_limit_satoshis` to a sufficient value to allow HTLC transactions to propagate through the Bitcoin network.
- set `htlc_minimum_msat` to the minimum value HTLC it's willing to accept from this peer.

The receiving node MUST:
Expand All @@ -801,7 +802,7 @@ The receiving node MAY fail the channel if:
- it considers `max_htlc_value_in_flight_msat` too small.
- it considers `channel_reserve_satoshis` too large.
- it considers `max_accepted_htlcs` too small.
- it considers `dust_limit_satoshis` too large.
- it considers `dust_limit_satoshis` too large (see [BOLT 3](03-transactions.md#dust-limits)).

The receiving node MUST fail the channel if:
- the `chain_hash` value is set to a hash of a chain that is unknown to the receiver.
Expand Down Expand Up @@ -842,7 +843,10 @@ are above both `dust_limit_satoshis`.

The receiver should not accept large `dust_limit_satoshis`, as this could be
used in griefing attacks, where the peer publishes its commitment with a lot
of dust htlcs, which effectively become miner fees.
of dust htlcs, which effectively become miner fees. But it must allow values
higher than the standard Bitcoin Core dust limits, since HTLC outputs need to
be spent by a second-stage transaction at a feerate matching the current
on-chain feerate.

Details for how to handle a channel failure can be found in [BOLT 5:Failing a Channel](05-onchain.md#failing-a-channel).

Expand Down
24 changes: 19 additions & 5 deletions 03-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,15 @@ To redeem the HTLC, the HTLC-success transaction is used as detailed below. This
### Trimmed Outputs

Each peer specifies a `dust_limit_satoshis` below which outputs should
not be produced; these outputs that are not produced are termed "trimmed". A trimmed output is
considered too small to be worth creating and is instead added
to the commitment transaction fee. For HTLCs, it needs to be taken into
account that the second-stage HTLC transaction may also be below the
limit.
not be produced; these outputs that are not produced are termed "trimmed".
A trimmed output is considered too small to be worth creating: it is instead
either added to the commitment transaction fee.

For HTLCs, it needs to be taken into account that the second-stage HTLC
transaction may also be below the limit. Note that when using `option_anchors`,
HTLC transactions don't include a fee and thus don't contribute to trimming:
setting a higher `dust_limit_satoshis` makes sense for those channels to ensure
that outputs are economical to spend.

#### Requirements

Expand Down Expand Up @@ -551,6 +555,7 @@ Bitcoin Core defines the following dust thresholds:
- pay to script hash (p2sh): 540 satoshis
- pay to witness pubkey hash (p2wpkh): 294 satoshis
- pay to witness script hash (p2wsh): 330 satoshis
- pay to anchor (p2a): 240 satoshis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should probably be part of: #1228

Copy link
Collaborator Author

@t-bast t-bast Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have it here since we "mirror" the dust limits set by Bitcoin Core, even for output types we don't use. For example, we don't use p2sh in lightning, but we do list it here for reference.

- unknown segwit versions: 354 satoshis
- `OP_RETURN` outputs: these are never dust

Expand All @@ -560,6 +565,15 @@ is explained in the following sections.
In all these sections, the calculations are done with a feerate of 3000 sat/kB
as per Bitcoin Core's implementation.

Note that since the introduction of `option_anchors`, the second-stage HTLC
transaction's weight is not taken into account when deciding whether outputs
should be included in the commitment transaction or not. It thus makes sense
to use a `dust_limit_satoshis` that takes into account the cost of those
second-stage HTLC transactions, to ensure that outputs added to the commitment
transaction can actually be claimed on-chain, otherwise they may pollute the
utxo set indefinitely. At a minimum, nodes should allow their peer to use a
`dust_limit_satoshis` that is higher than the values defined by Bitcoin Core.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you maybe also add a note describing that it can basically not be perfect, if the transaction fee of the base-layer stays for example very high for a long period of time HTLCs will be unspendable and on the other hand the dust limit cannot be too high because of the griefing attacks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 68c6544


### Pay to pubkey hash (p2pkh)

A p2pkh output is 34 bytes:
Expand Down