| 392 | }; |
| 393 | |
| 394 | static void init_feerange(struct feerange *feerange, |
| 395 | struct amount_sat commitment_fee, |
| 396 | const struct amount_sat offer[NUM_SIDES]) |
| 397 | { |
| 398 | feerange->min = AMOUNT_SAT(0); |
| 399 | |
| 400 | /* FIXME: BOLT 2 previously said that we have to set it to less than |
| 401 | * the final commit fee: we do this for now, still: |
| 402 | * |
| 403 | * - MUST set `fee_satoshis` less than or equal to the base |
| 404 | * fee of the final commitment transaction, as calculated |
| 405 | * in [BOLT #3](03-transactions.md#fee-calculation). |
| 406 | */ |
| 407 | feerange->max = commitment_fee; |
| 408 | |
| 409 | if (amount_sat_greater(offer[LOCAL], offer[REMOTE])) |
| 410 | feerange->higher_side = LOCAL; |
| 411 | else |
| 412 | feerange->higher_side = REMOTE; |
| 413 | |
| 414 | status_debug("Feerange init %s-%s, %s higher", |
| 415 | type_to_string(tmpctx, struct amount_sat, &feerange->min), |
| 416 | type_to_string(tmpctx, struct amount_sat, &feerange->max), |
| 417 | feerange->higher_side == LOCAL ? "local" : "remote"); |
| 418 | } |
| 419 | |
| 420 | static void adjust_feerange(struct feerange *feerange, |
| 421 | struct amount_sat offer, enum side side) |
no test coverage detected