@@ -801,6 +801,18 @@ static enum channel_add_err add_htlc(struct channel *channel,
801801
802802 if (amount_msat_greater (htlc_dust_amt ,
803803 channel -> config [LOCAL ].max_dust_htlc_exposure_msat )) {
804+ /* BOLT-919 #2:
805+ * A node:
806+ * - upon an incoming HTLC:
807+ * - if a HTLC's `amount_msat` is inferior to the
808+ * counterparty's `dust_limit_satoshis` plus the HTLC-timeout fee
809+ * at the `dust_buffer_feerate`: ...
810+ * - SHOULD fail this HTLC once it's committed
811+ * - SHOULD NOT reveal a preimage for this HTLC
812+ */
813+ /* Note: Marking this as 'fail_immediate' and
814+ * NOT returning an ERR will fail this HTLC
815+ * once it's committed */
804816 htlc -> fail_immediate = true;
805817 if (err_immediate_failures )
806818 return CHANNEL_ERR_DUST_FAILURE ;
@@ -1281,7 +1293,15 @@ bool channel_update_feerate(struct channel *channel, u32 feerate_per_kw)
12811293 if (!can_opener_afford_feerate (channel , feerate_per_kw ))
12821294 return false;
12831295
1284- if (!htlc_dust_ok (channel , feerate_per_kw , REMOTE ))
1296+ /* BOLT-919 #2:
1297+ * - if the `dust_balance_on_holder_tx` at the
1298+ * new `dust_buffer_feerate` is superior to
1299+ * the `max_dust_htlc_exposure_msat`:
1300+ * ...
1301+ * - MAY fail the channel
1302+ */
1303+ if (!htlc_dust_ok (channel , feerate_per_kw , REMOTE ) ||
1304+ !htlc_dust_ok (channel , feerate_per_kw , LOCAL ))
12851305 return false;
12861306
12871307 status_debug ("Setting %s feerate to %u" ,
0 commit comments