From 1faec99c59b662c4fa96d5ffaa88e884d7ea8dd8 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 13 Apr 2018 10:28:38 +0930 Subject: [PATCH] closingd: make sure we restrict feerange with initial offer. @ZmnSCPxj points out that this is allowed, though invalid: 1. commitment_fee = 1000 2. funder: 800 3. fundee: 200 4. funder: 900 We need to adjust the feerange using the initial funder offer. --- closingd/closing.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/closingd/closing.c b/closingd/closing.c index b23620d9c..12f690208 100644 --- a/closingd/closing.c +++ b/closingd/closing.c @@ -530,6 +530,10 @@ int main(int argc, char *argv[]) /* Now we have first two points, we can init fee range. */ init_feerange(&feerange, commitment_fee, offer, deprecated_api); + /* Apply (and check) funder offer now. */ + adjust_feerange(&cs, gossip_index, &channel_id, + &feerange, offer[funder], funder); + /* Now any extra rounds required. */ while (offer[LOCAL] != offer[REMOTE]) { /* Still don't agree: adjust feerange based on previous offer */