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

Function amount_msat_scale

common/amount.c:366–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366WARN_UNUSED_RESULT bool amount_msat_scale(struct amount_msat *val,
367 struct amount_msat msat,
368 double scale)
369{
370 if (scale != scale || scale < 0)
371 return false;
372
373 double scaled = msat.millisatoshis * scale;
374
375 /* If mantissa is < 64 bits, a naive "if (scaled >
376 * UINT64_MAX)" doesn't work. Stick to powers of 2. */
377 if (scaled >= (double)((u64)1 << 63) * 2)
378 return false;
379 val->millisatoshis = scaled;
380 return true;
381}
382
383WARN_UNUSED_RESULT bool amount_sat_scale(struct amount_sat *val,
384 struct amount_sat sat,

Callers 8

runFunction · 0.85
risk_priceFunction · 0.85
adaptive_splitter_cbFunction · 0.85
remove_excessFunction · 0.85
increase_flowsFunction · 0.85
linear_routesFunction · 0.85
get_htlc_maxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected