diff options
author | Murch <murch@murch.one> | 2023-06-14 16:52:08 -0400 |
---|---|---|
committer | Murch <murch@murch.one> | 2023-06-21 16:19:26 -0400 |
commit | 1771daa815ec014276cfcb30c934b0eaff4d72bf (patch) | |
tree | cfa78b74e47e39169f86fd4632c8ab5dd1a5c939 /src/wallet/test | |
parent | 941b8c6539d72890fd4e36fc900be9c300e1d737 (diff) |
[fuzz] Show that SRD budgets for non-dust change
Adding this assert to the fuzz test without increasing the change target
by the change_fee resulted in a crash within a few seconds.
Diffstat (limited to 'src/wallet/test')
-rw-r--r-- | src/wallet/test/fuzz/coinselection.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wallet/test/fuzz/coinselection.cpp b/src/wallet/test/fuzz/coinselection.cpp index bf457073e4..bc935157b1 100644 --- a/src/wallet/test/fuzz/coinselection.cpp +++ b/src/wallet/test/fuzz/coinselection.cpp @@ -91,7 +91,10 @@ FUZZ_TARGET(coinselection) const auto result_bnb = SelectCoinsBnB(group_pos, target, cost_of_change, MAX_STANDARD_TX_WEIGHT); auto result_srd = SelectCoinsSRD(group_pos, target, coin_params.m_change_fee, fast_random_context, MAX_STANDARD_TX_WEIGHT); - if (result_srd) result_srd->ComputeAndSetWaste(cost_of_change, cost_of_change, 0); + 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); + } 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); |