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

Function amount_sat_scale

common/amount.c:383–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383WARN_UNUSED_RESULT bool amount_sat_scale(struct amount_sat *val,
384 struct amount_sat sat,
385 double scale)
386{
387 if (scale != scale || scale < 0)
388 return false;
389
390 double scaled = sat.satoshis * scale;
391
392 /* If mantissa is < 64 bits, a naive "if (scaled >
393 * UINT64_MAX)" doesn't work. Stick to powers of 2. */
394 if (scaled >= (double)((u64)1 << 63) * 2)
395 return false;
396 val->satoshis = scaled;
397 return true;
398}
399
400WARN_UNUSED_RESULT bool amount_msat_add_sat_s64(struct amount_msat *val,
401 struct amount_msat a,

Callers 3

runFunction · 0.85
lease_rates_calc_feeFunction · 0.85
apply_policyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected