coin selection code does very badly in some cases #1643

issue dooglus opened this issue on August 1, 2012
  1. dooglus commented at 7:47 PM on August 1, 2012: contributor

    Take a look at transaction ce9c9afee7b3dd1deebdc49ceb1560d2771acb4cd0a4725042beecde726a3463.

    He was trying to send 0.0011 BTC, and was charged 0.0445 in fees. That's a 4045% charge. According to the user, there were "a lot of better fitting inputs".

    The coin selection code doesn't attempt to minimise fees. Perhaps it should.

    The transaction spent the following outputs:

    571 single satoshis, plus these 15 amounts which sum to 0.05559429:

    0.00007550 0.00009679 0.00011887 0.00014177 0.00019014 0.00042293 0.00045708 0.00049249 0.00056730 0.00134063 0.00178897 0.00187366 0.00196149 0.01070019 0.03536648

    If just the last of those 15 was used, the fee would have been either 0.0005 or 0.

  2. murchandamus cross-referenced this on Sep 13, 2014 from issue Issue#1643: Coinselection prunes extraneous inputs from ApproximateBestSubset by murchandamus
  3. murchandamus commented at 1:03 AM on September 13, 2014: contributor

    I have suggested an improvement at #4906 and would appreciate feedback.

  4. MarcoFalke cross-referenced this on Sep 1, 2015 from issue Transaction creation failed by ptschip
  5. MarcoFalke cross-referenced this on Sep 18, 2015 from issue [wallet] Adjust MIN_CHANGE by MarcoFalke
  6. laanwj cross-referenced this on Feb 16, 2016 from issue Oversize transaction: Coin selection ignoring large unspent, coalescing small unspents by jbreher
  7. laanwj cross-referenced this on Mar 11, 2016 from issue Revisit Coin Selection by morcos
  8. sipa commented at 5:45 PM on January 23, 2017: member

    I believe #9404 may also have improved upon this.

  9. MarcoFalke commented at 5:53 PM on January 23, 2017: member

    @sipa I don't think so, but I might be wrong. The issue is that ApproximateBestSubset right now will try to create an exact match, as was the case when this issue was filed. The bug you are referencing solved a fee calculation bug.

  10. laanwj removed the label Priority Medium on Apr 25, 2017
  11. suprnurd referenced this in commit 5f0da8aa71 on Dec 5, 2017
  12. MarcoFalke added the label TX fees and policy on Dec 20, 2017
  13. MarcoFalke cross-referenced this on Dec 20, 2017 from issue cost too many fees? by JokerCatz
  14. Sjors commented at 8:17 PM on March 16, 2018: member

    Recent discussion on coin selection #12605

  15. MarcoFalke cross-referenced this on Apr 29, 2018 from issue Coin selection, CreateTransaction, MAX_STANDARD_TX_SIZE by dexX7
  16. cryptozeny cross-referenced this on Dec 26, 2019 from issue Transaction too large by cryptozeny
  17. MarcoFalke commented at 8:00 PM on April 24, 2020: member

    Let's discuss further steps in #12605

  18. MarcoFalke closed this on Apr 24, 2020

  19. bitcoin locked this on Feb 15, 2022

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-05-19 06:55 UTC