docs: add doc comment for SRD selection algorithm #33622

pull yancyribbens wants to merge 2 commits into bitcoin:master from yancyribbens:add-doc-comment-to-SRD changing 1 files +5 −1
  1. yancyribbens commented at 1:05 pm on October 14, 2025: contributor
    The params documentation is missing change_fee and the description is lacking recent changes.
  2. DrahtBot added the label Docs on Oct 14, 2025
  3. DrahtBot commented at 1:06 pm on October 14, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33622.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  4. fanquake requested review from murchandamus on Oct 14, 2025
  5. yancyribbens commented at 4:52 pm on October 14, 2025: contributor
  6. in src/wallet/coinselection.cpp:538 in e6c439dcb2
    532@@ -533,6 +533,21 @@ class MinOutputGroupComparator
    533     }
    534 };
    535 
    536+/* Randomized Single Round Selection Algorithm.
    537+*
    538+* Full Description: This algorithm works by selecting inputs randomly until the target amount is
    


    brunoerg commented at 6:46 pm on October 14, 2025:

    e6c439dcb23e1a0d03261734fd89412a15b1932a: I don’t this it needs this “Full Description:”. It seems obvious that is the description of the algorithm.

    0This algorithm works by selecting inputs randomly until the target amount is
    

    yancyribbens commented at 8:20 pm on October 14, 2025:
    Some of the other algorithms use that wording, for example see coin-grinder: https://github.com/bitcoin/bitcoin/pull/33622/files#diff-d473ed8396f9451afb848923cfcfaa630c9811a78e07f3ae1ffd3a65da218accR208. Therefore just copying a pattern that already exists. Do you not like that wording in coin-grinder also?

    brunoerg commented at 8:42 pm on October 14, 2025:
    I think coin grinder explanation is more complex, so that makes sense. But anyway, feel free to ignore it.

    yancyribbens commented at 11:25 pm on October 14, 2025:
    No worries I can remove it then.
  7. in src/wallet/coinselection.cpp:544 in e6c439dcb2
    539+* reached or exceeded.  If the maximum weight is exceeded, then the least valuable inputs are
    540+* removed from the selection.  In so doing, minimize the number of UTXOs included in the result
    541+* by preferring UTXOs with higher value.  Note that this selection algorithm should always produce
    542+* a non-dust change output.
    543+*
    544+* @param std::vector<OutputGroup>& utxo_pool The UTXOs that we are choosing from.
    


    brunoerg commented at 7:04 pm on October 14, 2025:
    Aren’t there already documentation about the parameters in coinselection.h? If so, we should just add the description there instead.

    yancyribbens commented at 8:25 pm on October 14, 2025:
    There’s not much presidence for this when looking at how the other algorithms are documented. coin-grinder seems to have it documented in both the headers file and the cpp file.

    yancyribbens commented at 8:26 pm on October 14, 2025:
    I don’t care much either way where the doc comments are, just that it exists someplace that is findable.

    brunoerg commented at 8:43 pm on October 14, 2025:
    I think it’s weird to have a documentation about the paratemers in coinselection.h and another documentation about the same parameters but with different wording/explanation in coinselection.cpp.

    yancyribbens commented at 11:35 pm on October 14, 2025:

    Hmm it’s probably silly to have it both places. BnB for example does not have it’s params defined in .h at all, nor its description for that matter. And the params in .h for SRD are missing change_fee :face_palm:.

    Honestly, all these comments should be in the header file, right? It would be really hard to get people to review that kind of a change though.

  8. yancyribbens force-pushed on Oct 14, 2025
  9. yancyribbens force-pushed on Oct 14, 2025
  10. yancyribbens force-pushed on Oct 14, 2025
  11. yancyribbens commented at 11:59 pm on October 14, 2025: contributor
    @brunoerg thanks for reviewing. Instead of adding new docs I improved the comments in .h instead. If only the other selection algorithms did that as well..
  12. yancyribbens force-pushed on Oct 15, 2025
  13. doc: add missing param description to SRD d18a88a203
  14. doc: improve description for SRD selection algorithm
    Description is missing recent changes to the selection process.
    bbdfe22902
  15. yancyribbens force-pushed on Oct 15, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-10-31 18:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me