Merge bitcoin/bitcoin#36071: refactor: fuzz: remove cost_of_change from coin-grinder fuzz target
What changed, and why it matters
This commit removes one unused line from a fuzz test (a type of automated test that throws random data at code to find bugs). The removed line set a 'cost of change' value that the CoinGrinder coin-selection algorithm never actually reads. The change only affects test code, not the real Bitcoin wallet, and does not fix or introduce any security issue.
No security action required. This is a code-quality/test-only refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In src/wallet/test/fuzz/coinselection.cpp, the fuzz target for CoinGrinder previously assigned coin_params.m_cost_of_change based on effective and long-term fee rates. CoinGrinder does not consume m_cost_of_change, and the comparison logic in the fuzz target only cares about selection weight, so the assignment was dead/incorrect code. The patch deletes that single assignment. No runtime behavior of CoinGrinder or any other wallet selection algorithm changes.
Changed components
src/wallet/test/fuzz/coinselection.cppInspect captured patch +0 / −1
### src/wallet/test/fuzz/coinselection.cpp
@@ -92,7 +92,6 @@ FUZZ_TARGET(coin_grinder)
coin_params.m_effective_feerate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /*max=*/COIN)};
coin_params.change_output_size = fuzzed_data_provider.ConsumeIntegralInRange<int>(10, 1000);
coin_params.change_spend_size = fuzzed_data_provider.ConsumeIntegralInRange<int>(10, 1000);
- coin_params.m_cost_of_change= coin_params.m_effective_feerate.GetFee(coin_params.change_output_size) + coin_params.m_long_term_feerate.GetFee(coin_params.change_spend_size);
coin_params.m_change_fee = coin_params.m_effective_feerate.GetFee(coin_params.change_output_size);
// For other results to be comparable to SRD, we must align the change_target with SRD’s hardcoded behavior
coin_params.m_min_change_target = CHANGE_LOWER + coin_params.m_change_fee;Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.