CoinGrinder and SRD disagree on small change #33352

issue yancyribbens opened this issue on September 9, 2025
  1. yancyribbens commented at 6:03 PM on September 9, 2025: contributor

    Both CoinGrinder and SRD create a change output, however they disagree on what change output is too small.

    Consider SRD selection, which adds CHANGE_LOWER to the target value and in so doing, prevents a selection that is less than CHANGE_LOWER ref

    target_value += CHANGE_LOWER + change_fee;
    

    However, CoinGrinder does not add CHANGE_LOWER ref

    const CAmount total_target = selection_target + change_target;
    

    I believe the correct behavior is for CoinGrinder to add CHANGE_LOWER to the total_target, like so:

    const CAmount total_target = selection_target + CHANGE_LOWER + change_target;
    
  2. yancyribbens commented at 6:04 PM on September 9, 2025: contributor
  3. murchandamus commented at 6:19 PM on September 9, 2025: contributor

    This is intentional.

    Knapsack and CoinGrinder use GenerateChangeTarget to make a randomized minimum change, because these two algorithms minimize the overshoot over the minimum change which led to a fingerprint and a clustering of change outputs of the same value. SRD randomly selects inputs, so it already overshoots the minimum change by a random amount.

  4. achow101 closed this on Sep 9, 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: 2026-04-25 00:12 UTC

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