Skip to content

Commit

Permalink
fuzz: coinselection: add coverage for SetBumpFeeDiscount
Browse files Browse the repository at this point in the history
Call `SetBumpFeeDiscount` before recalculating waste.
  • Loading branch information
brunoerg committed Jan 24, 2025
1 parent 2d07384 commit 9a1143c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wallet/test/fuzz/coinselection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ FUZZ_TARGET(coinselection)
assert(result_srd->GetSelectedValue() >= target);
assert(result_srd->GetChange(CHANGE_LOWER, coin_params.m_change_fee) > 0); // Demonstrate that SRD creates change of at least CHANGE_LOWER
assert(result_srd->GetWeight() <= max_selection_weight);
if (fuzzed_data_provider.ConsumeBool()) {
result_srd->SetBumpFeeDiscount(ConsumeMoney(fuzzed_data_provider));
}
result_srd->RecalculateWaste(coin_params.min_viable_change, coin_params.m_cost_of_change, coin_params.m_change_fee);
(void)result_srd->GetShuffledInputVector();
(void)result_srd->GetInputSet();
Expand All @@ -285,6 +288,9 @@ FUZZ_TARGET(coinselection)
if (result_knapsack) {
assert(result_knapsack->GetSelectedValue() >= target);
assert(result_knapsack->GetWeight() <= max_selection_weight);
if (fuzzed_data_provider.ConsumeBool()) {
result_knapsack->SetBumpFeeDiscount(ConsumeMoney(fuzzed_data_provider));
}
result_knapsack->RecalculateWaste(coin_params.min_viable_change, coin_params.m_cost_of_change, coin_params.m_change_fee);
(void)result_knapsack->GetShuffledInputVector();
(void)result_knapsack->GetInputSet();
Expand Down

0 comments on commit 9a1143c

Please sign in to comment.