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

Function amount_msat_fee

common/amount.c:526–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526bool amount_msat_fee(struct amount_msat *fee,
527 struct amount_msat amt,
528 u32 fee_base_msat,
529 u32 fee_proportional_millionths)
530{
531 struct amount_msat fee_base, fee_prop;
532
533 /* BOLT #7:
534 *
535 * - SHOULD accept HTLCs that pay a fee equal to or greater than:
536 * - fee_base_msat + ( amount_to_forward * fee_proportional_millionths / 1000000 )
537 */
538 fee_base.millisatoshis = fee_base_msat;
539
540 if (mul_overflows_u64(amt.millisatoshis, fee_proportional_millionths))
541 return false;
542 fee_prop.millisatoshis = amt.millisatoshis * fee_proportional_millionths
543 / 1000000;
544
545 return amount_msat_add(fee, fee_base, fee_prop);
546}
547
548bool amount_msat_add_fee(struct amount_msat *amt,
549 u32 fee_base_msat,

Callers 5

check_fwd_amountFunction · 0.85
amount_msat_add_feeFunction · 0.85
json_keysendFunction · 0.85
json_payFunction · 0.85

Calls 2

mul_overflows_u64Function · 0.85
amount_msat_addFunction · 0.85

Tested by

no test coverage detected