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

Function amount_msat_scale

common/amount.c:335–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334
335WARN_UNUSED_RESULT bool amount_msat_scale(struct amount_msat *val,
336 struct amount_msat msat,
337 double scale)
338{
339 double scaled = msat.millisatoshis * scale;
340
341 /* If mantissa is < 64 bits, a naive "if (scaled >
342 * UINT64_MAX)" doesn't work. Stick to powers of 2. */
343 if (scaled >= (double)((u64)1 << 63) * 2)
344 return false;
345 val->millisatoshis = scaled;
346 return true;
347}
348
349WARN_UNUSED_RESULT bool amount_sat_scale(struct amount_sat *val,
350 struct amount_sat sat,

Callers 3

risk_priceFunction · 0.85
presplit_cbFunction · 0.85
adaptive_splitter_cbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected