@@ -804,6 +804,18 @@ static enum channel_add_err add_htlc(struct channel *channel,
804
804
805
805
if (amount_msat_greater (htlc_dust_amt ,
806
806
channel -> config [LOCAL ].max_dust_htlc_exposure_msat )) {
807
+ /* BOLT-919 #2:
808
+ * A node:
809
+ * - upon an incoming HTLC:
810
+ * - if a HTLC's `amount_msat` is inferior to the
811
+ * counterparty's `dust_limit_satoshis` plus the HTLC-timeout fee
812
+ * at the `dust_buffer_feerate`: ...
813
+ * - SHOULD fail this HTLC once it's committed
814
+ * - SHOULD NOT reveal a preimage for this HTLC
815
+ */
816
+ /* Note: Marking this as 'fail_immediate' and
817
+ * NOT returning an ERR will fail this HTLC
818
+ * once it's committed */
807
819
htlc -> fail_immediate = true;
808
820
if (err_immediate_failures )
809
821
return CHANNEL_ERR_DUST_FAILURE ;
@@ -1284,7 +1296,15 @@ bool channel_update_feerate(struct channel *channel, u32 feerate_per_kw)
1284
1296
if (!can_opener_afford_feerate (channel , feerate_per_kw ))
1285
1297
return false;
1286
1298
1287
- if (!htlc_dust_ok (channel , feerate_per_kw , REMOTE ))
1299
+ /* BOLT-919 #2:
1300
+ * - if the `dust_balance_on_holder_tx` at the
1301
+ * new `dust_buffer_feerate` is superior to
1302
+ * the `max_dust_htlc_exposure_msat`:
1303
+ * ...
1304
+ * - MAY fail the channel
1305
+ */
1306
+ if (!htlc_dust_ok (channel , feerate_per_kw , REMOTE ) ||
1307
+ !htlc_dust_ok (channel , feerate_per_kw , LOCAL ))
1288
1308
return false;
1289
1309
1290
1310
status_debug ("Setting %s feerate to %u" ,
0 commit comments