MCPcopy Create free account
hub / github.com/ElementsProject/lightning / adjust_feerange

Function adjust_feerange

closingd/closingd.c:438–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438static void adjust_feerange(struct feerange *feerange,
439 struct amount_sat offer, enum side side)
440{
441 bool ok;
442
443 /* FIXME: BOLT 2 previously said that we have to set it to less than
444 * the final commit fee: we do this for now, still:
445 *
446 * - MUST propose a value "strictly between" the received
447 * `fee_satoshis` and its previously-sent `fee_satoshis`.
448 */
449 if (side == feerange->higher_side)
450 ok = amount_sat_sub(&feerange->max, offer, AMOUNT_SAT(1));
451 else
452 ok = amount_sat_add(&feerange->min, offer, AMOUNT_SAT(1));
453
454 status_debug("Feerange %s update %s: now %s-%s",
455 side == LOCAL ? "local" : "remote",
456 fmt_amount_sat(tmpctx, offer),
457 fmt_amount_sat(tmpctx, feerange->min),
458 fmt_amount_sat(tmpctx, feerange->max));
459
460 if (!ok)
461 status_failed(STATUS_FAIL_INTERNAL_ERROR,
462 "Overflow in updating fee range");
463}
464
465/* Do these two ranges overlap? If so, return that range. */
466static bool get_overlap(const struct tlv_closing_signed_tlvs_fee_range *r1,

Callers 1

mainFunction · 0.85

Calls 4

amount_sat_subFunction · 0.50
amount_sat_addFunction · 0.50
fmt_amount_satFunction · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected