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

Function init_feerange

closingd/closingd.c:394–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392};
393
394static void init_feerange(struct feerange *feerange,
395 struct amount_sat commitment_fee,
396 const struct amount_sat offer[NUM_SIDES])
397{
398 feerange->min = AMOUNT_SAT(0);
399
400 /* FIXME: BOLT 2 previously said that we have to set it to less than
401 * the final commit fee: we do this for now, still:
402 *
403 * - MUST set `fee_satoshis` less than or equal to the base
404 * fee of the final commitment transaction, as calculated
405 * in [BOLT #3](03-transactions.md#fee-calculation).
406 */
407 feerange->max = commitment_fee;
408
409 if (amount_sat_greater(offer[LOCAL], offer[REMOTE]))
410 feerange->higher_side = LOCAL;
411 else
412 feerange->higher_side = REMOTE;
413
414 status_debug("Feerange init %s-%s, %s higher",
415 type_to_string(tmpctx, struct amount_sat, &feerange->min),
416 type_to_string(tmpctx, struct amount_sat, &feerange->max),
417 feerange->higher_side == LOCAL ? "local" : "remote");
418}
419
420static void adjust_feerange(struct feerange *feerange,
421 struct amount_sat offer, enum side side)

Callers 1

mainFunction · 0.85

Calls 2

amount_sat_greaterFunction · 0.85
type_to_stringClass · 0.50

Tested by

no test coverage detected