| 413 | } |
| 414 | |
| 415 | static void adjust_feerange(struct feerange *feerange, |
| 416 | struct amount_sat offer, enum side side) |
| 417 | { |
| 418 | bool ok; |
| 419 | |
| 420 | /* FIXME: BOLT 2 previously said that we have to set it to less than |
| 421 | * the final commit fee: we do this for now, still: |
| 422 | * |
| 423 | * - MUST propose a value "strictly between" the received |
| 424 | * `fee_satoshis` and its previously-sent `fee_satoshis`. |
| 425 | */ |
| 426 | if (side == feerange->higher_side) |
| 427 | ok = amount_sat_sub(&feerange->max, offer, AMOUNT_SAT(1)); |
| 428 | else |
| 429 | ok = amount_sat_add(&feerange->min, offer, AMOUNT_SAT(1)); |
| 430 | |
| 431 | status_debug("Feerange %s update %s: now %s-%s", |
| 432 | side == LOCAL ? "local" : "remote", |
| 433 | fmt_amount_sat(tmpctx, offer), |
| 434 | fmt_amount_sat(tmpctx, feerange->min), |
| 435 | fmt_amount_sat(tmpctx, feerange->max)); |
| 436 | |
| 437 | if (!ok) |
| 438 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 439 | "Overflow in updating fee range"); |
| 440 | } |
| 441 | |
| 442 | /* Do these two ranges overlap? If so, return that range. */ |
| 443 | static bool get_overlap(const struct tlv_closing_signed_tlvs_fee_range *r1, |
no test coverage detected