channeld: update dust limit checks to the final version of PR 919.
What changed, and why it matters
This commit tightens the rules for when a Lightning node rejects a fee-rate change from the other party. It now skips certain 'dust exposure' checks when a modern anchor-based channel is in use, and only checks the remote side's dust exposure when the fee is actually increasing. This aligns the code with the final version of a published protocol specification change (BOLT PR 919). The change is defensive: it reduces the chance that a peer can force your node to close a channel by manipulating fees, but it is a partial patch that only updates one of the places where dust limits matter.
Review the remaining dust-limit checks across the codebase (especially other htlc_dust_ok() call sites and commitment transaction construction) to ensure the final BOLT PR 919 rules are applied consistently. Run protocol-conformance tests covering fee updates, dust HTLCs, and anchor channels. Consider whether the unconditional LOCAL check should also be gated by a fee-increase condition per the spec wording.
Security signals we found
Protocol rule change that affects when a channel may be failed/closed due to fee updates
Skips dust-exposure validation entirely for anchor-based channels (OPT_ANCHORS_ZERO_FEE_HTLC_TX)
Adds conditional remote-side check only on fee increases, reducing peer-forced close surface
References a specific BOLT specification pull request (PR 919) in code comment
Single-file, narrow change; broader dust-limit logic elsewhere in the tree is not updated
Evidence from the diff
The patch updates channel_update_feerate() in channeld/full_channel.c to implement the final BOLT PR 919 dust-limit wording. Previously the code unconditionally checked htlc_dust_ok() for both REMOTE and LOCAL at the new feerate. The new logic: (1) if option_anchors_zero_fee_htlc_tx is negotiated, skip all dust checks; (2) otherwise, only check REMOTE dust exposure when feerate_per_kw is increasing; (3) always check LOCAL dust exposure. This prevents unnecessary channel failures on anchor channels and avoids rejecting remote fee decreases that do not worsen dust exposure. The commit is a spec-alignment change; it does not add new validation for the symmetric case and leaves other call sites untouched, so it is a partial implementation of the spec change.
Changed components
channeld/full_channel.cchannel_update_feerate()HTLC dust-exposure validationBOLT #2 fee-update handlingInspect captured patch +23 / −9
diff --git a/channeld/full_channel.c b/channeld/full_channel.c
index b3690995..5e658625 100644
--- a/channeld/full_channel.c
+++ b/channeld/full_channel.c
@@ -1434,16 +1434,30 @@ bool channel_update_feerate(struct channel *channel, u32 feerate_per_kw)
if (!can_opener_afford_feerate(channel, feerate_per_kw))
return false;
- /* BOLT-919 #2:
- * - if the `dust_balance_on_holder_tx` at the
- * new `dust_buffer_feerate` is superior to
- * the `max_dust_htlc_exposure_msat`:
- * ...
- * - MAY fail the channel
+ /* BOLT #2:
+ * - if `option_anchors` was not negotiated:
+ * - if the `update_fee` increases `feerate_per_kw`:
+ * - if the dust balance of the remote transaction at the
+ * updated `feerate_per_kw` is greater then `max_dust_htlc_exposure_msat`:
+ * - MAY fail the channel
+ * - if the dust balance of the local transaction at the
+ * updated `feerate_per_kw` is greater than `max_dust_htlc_exposure_msat`:
+ * - MAY fail the channel
*/
- if (!htlc_dust_ok(channel, feerate_per_kw, REMOTE) ||
- !htlc_dust_ok(channel, feerate_per_kw, LOCAL))
- return false;
+ if (!channel_has(channel, OPT_ANCHORS_ZERO_FEE_HTLC_TX)) {
+ if (feerate_per_kw > channel_feerate(channel, REMOTE)) {
+ if (!htlc_dust_ok(channel, feerate_per_kw, REMOTE)) {
+ status_unusual("Feerate %u is too dusty for remote",
+ feerate_per_kw);
+ return false;
+ }
+ }
+ if (!htlc_dust_ok(channel, feerate_per_kw, LOCAL)) {
+ status_unusual("Feerate %u is too dusty for local",
+ feerate_per_kw);
+ return false;
+ }
+ }
status_debug("Setting %s feerate to %u",
side_to_str(!channel->opener), feerate_per_kw);
Why this scored 38/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.