Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions openingd/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ bool check_config_bounds(const tal_t *ctx,
return false;
}

/* BOLT #2:
*
* The receiving node MUST fail the channel if:
*...
* - `dust_limit_satoshis` is smaller than `354 satoshis` (see [BOLT 3](03-transactions.md#dust-limits)).
*/
if (amount_sat_less(remoteconf->dust_limit, AMOUNT_SAT(354))) {
*err_reason = tal_fmt(ctx,
"dust_limit_satoshis %s too small",
fmt_amount_sat(ctx, remoteconf->dust_limit));
return false;
}

return true;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/fuzz/fuzz-open_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ static u8 *create_open_channel_msg(const tal_t *ctx, struct state *state)
if (to_self_delay > state->max_to_self_delay)
to_self_delay = state->max_to_self_delay;

if (amount_sat_less(dust_limit_satoshis, AMOUNT_SAT(354)))
dust_limit_satoshis = AMOUNT_SAT(354);

struct amount_sat total_reserve;
if (!amount_sat_add(&total_reserve,
channel_reserve_satoshis,
Expand Down