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

Function adjust_feerange

closingd/closingd.c:415–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415static 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. */
443static 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