Refactor SelectCoinsMinConf() and add unit tests #1416

pull luke-jr wants to merge 5 commits into bitcoin:master from luke-jr:refactor_coinselect changing 3 files +437 −83
  1. luke-jr commented at 4:55 PM on June 4, 2012: member

    AvailableCoins() makes a vector of available outputs which is then passed to SelectCoinsMinConf(). This allows unit tests to test the coin selection algorithm without having the whole blockchain available.

    This is an updated (with changes made in #1017, but not Coin Control itself) and rebased form of #905.

  2. Refactor SelectCoinsMinConf() and add unit tests.
    AvailableCoins() makes a vector of available outputs which is then passed to SelectCoinsMinConf().  This allows unit tests to test the coin selection algorithm without having the whole blockchain available.
    9b0369c773
  3. Move the random_shuffle call back into SelectCoinsMinConf() so we can unit test it. e333ab56d5
  4. Test that the coin selection code is suitably random, and add tests re. sub-cent change. 4ce190a015
  5. Preserve the shuffled order of coins with equal value to give more randomized coin selection. d650f96d5f
  6. Fix coin selection to only include change when it's necessary. 831f59ce8b
  7. gavinandresen commented at 12:06 AM on June 5, 2012: contributor

    ACK. It makes ./test_bitcoin spew tons of "best subset" messages, but that's not your fault.

  8. sipa commented at 11:43 AM on June 13, 2012: member

    ACK

  9. gavinandresen commented at 1:35 AM on June 14, 2012: contributor

    ACK

  10. gavinandresen merged this on Jun 14, 2012
  11. gavinandresen closed this on Jun 14, 2012

  12. lateminer referenced this in commit 06abba7a14 on Jan 22, 2019
  13. lateminer referenced this in commit be6f1279b6 on May 6, 2020
  14. DrahtBot locked this on Sep 8, 2021

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-14 15:16 UTC

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