We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea810b7 commit 5eb121fCopy full SHA for 5eb121f
common/amount.c
@@ -303,7 +303,9 @@ WARN_UNUSED_RESULT bool amount_msat_scale(struct amount_msat *val,
303
{
304
double scaled = sat.millisatoshis * scale;
305
306
- if (scaled > UINT64_MAX)
+ /* If mantissa is < 64 bits, a naive "if (scaled >
307
+ * UINT64_MAX)" doesn't work. Stick to powers of 2. */
308
+ if (scaled >= (double)((u64)1 << 63) * 2)
309
return false;
310
val->millisatoshis = scaled;
311
return true;
0 commit comments