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