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

Function amount_msat_fee

common/amount.c:622–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622bool amount_msat_fee(struct amount_msat *fee,
623 struct amount_msat amt,
624 u32 fee_base_msat,
625 u32 fee_proportional_millionths)
626{
627 struct amount_msat fee_base, fee_prop;
628
629 /* BOLT #7:
630 *
631 * - SHOULD accept HTLCs that pay a fee equal to or greater than:
632 * - fee_base_msat + ( amount_to_forward * fee_proportional_millionths / 1000000 )
633 */
634 fee_base.millisatoshis = fee_base_msat;
635 if (!amount_msat_mul_div(&fee_prop, amt, fee_proportional_millionths,
636 1000000))
637 return false;
638
639 return amount_msat_add(fee, fee_base, fee_prop);
640}
641
642/* Does this input give enough to provide fee for output? */
643static bool within_fee(struct amount_msat in,

Callers 12

check_fwd_amountFunction · 0.85
runFunction · 0.85
amount_msat_add_feeFunction · 0.85
dijkstra_Function · 0.85
test_amount_feeFunction · 0.85
json_keysendFunction · 0.85
json_payFunction · 0.85
mainFunction · 0.85
new_paymentFunction · 0.85
calc_maxfeeFunction · 0.85

Calls 2

amount_msat_mul_divFunction · 0.85
amount_msat_addFunction · 0.85

Tested by 2

test_amount_feeFunction · 0.68
mainFunction · 0.68