From 8b8f703db3655da4b624df24f8e925d57b99fa6a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 18 Mar 2024 14:37:04 +1030 Subject: [PATCH] dualopend: make is_dust test match the spec. Signed-off-by: Rusty Russell --- openingd/dualopend.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openingd/dualopend.c b/openingd/dualopend.c index fe36e140a..2076c95cb 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -564,11 +564,18 @@ static void check_channel_id(struct state *state, id_in)); } +/* BOLT #2: + * The receiving node: + *... + * - MUST fail the negotiation if: + *... + * - the `sats` amount is less than the `dust_limit` + */ static bool is_dust(struct tx_state *tx_state, struct amount_sat amount) { - return !amount_sat_greater(amount, tx_state->localconf.dust_limit) - || !amount_sat_greater(amount, tx_state->remoteconf.dust_limit); + return amount_sat_less(amount, tx_state->localconf.dust_limit) + || amount_sat_less(amount, tx_state->remoteconf.dust_limit); } static char *validate_inputs(struct state *state,