doc: add missing param description to SRD
What changed, and why it matters
This commit only updates a code comment (documentation) for a coin-selection function called SRD. It adds a missing description of one parameter and clarifies how the algorithm works. No program logic, code behavior, or security properties were changed.
No action required; this is a non-functional documentation update.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff is a pure documentation change in src/wallet/coinselection.h. It expands the Doxygen comment for SelectCoinsSRD to describe the change_fee parameter and explain the greedy selection/drop behavior. No executable code, signatures, or data flows were modified.
Changed components
src/wallet/coinselection.h documentation comment for SRDInspect captured patch +7 / −2
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h
index ca9f2698..1d4bc86b 100644
--- a/src/wallet/coinselection.h
+++ b/src/wallet/coinselection.h
@@ -446,11 +446,16 @@ util::Result<SelectionResult> SelectCoinsBnB(std::vector<OutputGroup>& utxo_pool
util::Result<SelectionResult> CoinGrinder(std::vector<OutputGroup>& utxo_pool, const CAmount& selection_target, CAmount change_target, int max_selection_weight);
-/** Select coins by Single Random Draw. OutputGroups are selected randomly from the eligible
- * outputs until the target is satisfied
+/** Select coins by Single Random Draw (SRD). SRD selects eligible OutputGroups from a shuffled
+ * ordering until the effective value of the input set suffices to create the recipient outputs and a
+ * change output with an amount of at least CHANGE_LOWER. While the maximum selection
+ * weight is exceeded during selection, the OutputGroup with the lowest effective value is dropped
+ * from the selection before additional OutputGroups are selected. Due to this greedy approach,
+ * SRD can fail to discover possible solutions in pathological cases.
*
* @param[in] utxo_pool The positive effective value OutputGroups eligible for selection
* @param[in] target_value The target value to select for
+ * @param[in] change_fee The cost of adding the change output to the transaction at the transaction’s feerate.
* @param[in] rng The randomness source to shuffle coins
* @param[in] max_selection_weight The maximum allowed weight for a selection result to be valid
* @returns If successful, a valid SelectionResult, otherwise, util::Error
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.