Merge bitcoin/bitcoin#33622: docs: add doc comment for SRD selection algorithm

3400db80401d65ba16b52e5055486c75cd1412ff doc: add missing param description to SRD (yancy)

Pull request description:

  The params documentation is missing `change_fee` and the description is lacking recent changes.

ACKs for top commit:
  murchandamus:
    ACK 3400db80401d65ba16b52e5055486c75cd1412ff
  brunoerg:
    code review ACK 3400db80401d65ba16b52e5055486c75cd1412ff

Tree-SHA512: 8f6fac0d92873c5c9f77b19fbc0c6ecfb425b2a6b3d5f5ad69c82ed706b21cf4627e68c71acbc43661000e6063e8f8dbcd3b8ff60e3c727bdcba497d13ee1383
This commit is contained in:
merge-script 2026-01-28 14:38:16 +01:00
commit d9e651f995
No known key found for this signature in database
GPG Key ID: 9B79B45691DB4173

View File

@ -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 transactions 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