From d2165ff4d855d158caa0661f67d8f2ab96d762aa Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 7 Apr 2020 11:49:07 +0200 Subject: [PATCH] lightningd: Don't accept 0sat for closing fee step We must give up something on each negotiation step. Can't take 0 satoshi as an argument. Changelog-None --- lightningd/peer_control.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 9041eccbc..ae7d4ae59 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1370,9 +1370,15 @@ static struct command_result *json_close(struct command *cmd, } else { channel->closing_fee_negotiation_step = strtoull(fee_negotiation_step_str, &end, 10); - if (*end == '%') { - if (channel->closing_fee_negotiation_step < 1 || - channel->closing_fee_negotiation_step > 100) + + if (channel->closing_fee_negotiation_step == 0) + return command_fail( + cmd, JSONRPC2_INVALID_PARAMS, + "Wrong value given for fee_negotiation_step: " + "\"%s\", must be positive", + fee_negotiation_step_str); + else if (*end == '%') { + if (channel->closing_fee_negotiation_step > 100) return command_fail( cmd, JSONRPC2_INVALID_PARAMS, "Wrong value given for "