diff options
author | S3RK <1466284+S3RK@users.noreply.github.com> | 2022-08-15 09:30:31 +0200 |
---|---|---|
committer | S3RK <1466284+S3RK@users.noreply.github.com> | 2022-08-15 09:34:26 +0200 |
commit | c8cf08ea743e430c2bf3fe46439594257b0937e5 (patch) | |
tree | 81f06a202081dd8c4402d524b70ad359d8ac7af6 /src/wallet/test | |
parent | dc9d6626835ec2864dfa747c12071dabdc95b919 (diff) | |
download | bitcoin-c8cf08ea743e430c2bf3fe46439594257b0937e5.tar.xz |
wallet: ensure m_min_change_target always covers change fee
Diffstat (limited to 'src/wallet/test')
-rw-r--r-- | src/wallet/test/fuzz/coinselection.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/test/fuzz/coinselection.cpp b/src/wallet/test/fuzz/coinselection.cpp index 3465f2f331..52bd74126d 100644 --- a/src/wallet/test/fuzz/coinselection.cpp +++ b/src/wallet/test/fuzz/coinselection.cpp @@ -58,6 +58,8 @@ FUZZ_TARGET(coinselection) coin_params.m_subtract_fee_outputs = subtract_fee_outputs; coin_params.m_long_term_feerate = long_term_fee_rate; coin_params.m_effective_feerate = effective_fee_rate; + coin_params.change_output_size = fuzzed_data_provider.ConsumeIntegralInRange<int>(10, 1000); + coin_params.m_change_fee = effective_fee_rate.GetFee(coin_params.change_output_size); // Create some coins CAmount total_balance{0}; @@ -85,7 +87,7 @@ FUZZ_TARGET(coinselection) auto result_srd = SelectCoinsSRD(group_pos, target, fast_random_context); if (result_srd) result_srd->ComputeAndSetWaste(cost_of_change); - CAmount change_target{GenerateChangeTarget(target, fast_random_context)}; + 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); if (result_knapsack) result_knapsack->ComputeAndSetWaste(cost_of_change); |