From 890a09b1e49925315a5636f29cc5af36928fe092 Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Fri, 27 Mar 2026 17:31:02 -0700 Subject: [PATCH] fuzz: Use CAmount for storing best_waste Waste is a CAmount, which is an int64_t. This will overflow an int, so `best_waste` should also be a `CAmount`. --- 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 8b30423c6f2..42a53a83c34 100644 --- a/src/wallet/test/fuzz/coinselection.cpp +++ b/src/wallet/test/fuzz/coinselection.cpp @@ -275,7 +275,7 @@ FUZZ_TARGET(bnb_finds_min_waste) // Brute force optimal solution (lowest waste, but cannot be superset of another solution) std::vector solutions; - int best_waste{std::numeric_limits::max()}; + CAmount best_waste{std::numeric_limits::max()}; int best_weight{std::numeric_limits::max()}; for (uint32_t pattern = 1; (pattern >> num_groups) == 0; ++pattern) { // BnB does not permit adding more inputs to a solution, i.e. a superset of a solution cannot ever be a solution.