From 9dae3b970a7a82e8d9f3f755048d427da78c49da Mon Sep 17 00:00:00 2001 From: Murch Date: Wed, 21 Feb 2024 15:49:05 -0500 Subject: [PATCH] [fuzz] Avoid partial negative result --- src/wallet/test/fuzz/coinselection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/test/fuzz/coinselection.cpp b/src/wallet/test/fuzz/coinselection.cpp index 3ffeecdf34384..297432de9efc5 100644 --- a/src/wallet/test/fuzz/coinselection.cpp +++ b/src/wallet/test/fuzz/coinselection.cpp @@ -158,7 +158,7 @@ FUZZ_TARGET(coin_grinder_is_optimal) // Only make UTXOs with positive effective value const CAmount input_fee = coin_params.m_effective_feerate.GetFee(n_input_bytes); // Ensure that each UTXO has at least an effective value of 1 sat - const CAmount eff_value{fuzzed_data_provider.ConsumeIntegralInRange(1, MAX_MONEY - max_spendable - max_output_groups + group_pos.size())}; + const CAmount eff_value{fuzzed_data_provider.ConsumeIntegralInRange(1, MAX_MONEY + group_pos.size() - max_spendable - max_output_groups)}; const CAmount amount{eff_value + input_fee}; std::vector temp_utxo_pool;