From f0244a8614ee35caef03bc326519823972ec61b4 Mon Sep 17 00:00:00 2001 From: brunoerg Date: Thu, 4 May 2023 15:02:09 -0300 Subject: fuzz: coinselection, add coverage for `GetShuffledInputVector`/`GetInputSet` --- src/wallet/test/fuzz/coinselection.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/wallet/test/fuzz/coinselection.cpp b/src/wallet/test/fuzz/coinselection.cpp index 1a682599fe..03a3e7c67a 100644 --- a/src/wallet/test/fuzz/coinselection.cpp +++ b/src/wallet/test/fuzz/coinselection.cpp @@ -100,16 +100,26 @@ FUZZ_TARGET(coinselection) // Run coinselection algorithms auto result_bnb = SelectCoinsBnB(group_pos, target, cost_of_change, MAX_STANDARD_TX_WEIGHT); + if (result_bnb) { + (void)result_bnb->GetShuffledInputVector(); + (void)result_bnb->GetInputSet(); + } auto result_srd = SelectCoinsSRD(group_pos, target, coin_params.m_change_fee, fast_random_context, MAX_STANDARD_TX_WEIGHT); if (result_srd) { assert(result_srd->GetChange(CHANGE_LOWER, coin_params.m_change_fee) > 0); // Demonstrate that SRD creates change of at least CHANGE_LOWER result_srd->ComputeAndSetWaste(cost_of_change, cost_of_change, 0); + (void)result_srd->GetShuffledInputVector(); + (void)result_srd->GetInputSet(); } CAmount change_target{GenerateChangeTarget(target, coin_params.m_change_fee, fast_random_context)}; auto result_knapsack = KnapsackSolver(group_all, target, change_target, fast_random_context, MAX_STANDARD_TX_WEIGHT); - if (result_knapsack) result_knapsack->ComputeAndSetWaste(cost_of_change, cost_of_change, 0); + if (result_knapsack) { + result_knapsack->ComputeAndSetWaste(cost_of_change, cost_of_change, 0); + (void)result_knapsack->GetShuffledInputVector(); + (void)result_knapsack->GetInputSet(); + } // If the total balance is sufficient for the target and we are not using // effective values, Knapsack should always find a solution (unless the selection exceeded the max tx weight). -- cgit v1.2.3