fuzz-tests: fix overflow of u32 in fuzz-close-tx

Changelog-None: The value WALLY_SATOSHI_PER_BTC * WALLY_BTC_MAX
is equal to 2.1e15, which is much higher than the maximum capacity
of a u32, which is 4.29e9.

Hence, use a u64 to store this value instead.
This commit is contained in:
Chandra Pratap
2025-06-19 10:35:34 +00:00
committed by Rusty Russell
parent 17cf63aec3
commit 20e252b548

View File

@@ -54,7 +54,7 @@ void run(const uint8_t *data, size_t size)
if (!(amount_sat_add(&funding, to_us, to_them)))
return;
/* .. And < max_btc as we assert it's not nonsensical! */
max = AMOUNT_SAT((u32)WALLY_SATOSHI_PER_BTC * WALLY_BTC_MAX);
max = AMOUNT_SAT((u64)WALLY_SATOSHI_PER_BTC * WALLY_BTC_MAX);
if (amount_sat_greater(funding, max)) {
funding = max;
to_us = amount_sat_div(max, 2);