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.
This commit is contained in:
Rusty Russell 2018-04-13 10:28:38 +09:30 committed by Christian Decker
parent 7ca4422d7d
commit 1faec99c59
1 changed files with 4 additions and 0 deletions

View File

@ -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 */