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

Function adjust_feerange

closingd/closingd.c:420–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420static 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. */
448static 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
type_to_stringClass · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected