Stop creating change outputs when not necessary #10329

issue RHavar opened this issue on May 3, 2017
  1. RHavar commented at 4:20 PM on May 3, 2017: contributor

    This issue follows the discussion from here.

    Core currently does an exact match to check if it should omit the change output when creating a transaction. However the correct logic should be to have a little of leeway, donating extra money to miners if required.

    (This is because creating a change output itself isn't free, you need to pay the extra bytes in the transaction, and in the future source that change output at least paying relayfee).

    So instead of an exact match against amount == target it should check if it's amount >= target && amount < target + sizeof(a_change_output) * fee_rate + sizeof(sourcing_that_change) * relayFee).

    This has the benefit of improving coin selection, but most importantly it will hugely improve privacy for bitcoin users as it'll break a lot of the wallet clustering logic that identifies change outputs.

  2. instagibbs commented at 9:41 PM on May 3, 2017: member

    Change outputs are created or not due to this check: https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2538

    Seems that would line up with any SelectCoinsMinConf change you'd want made?

  3. RHavar commented at 9:54 PM on May 3, 2017: contributor

    Yeah, pretty much. Although I don't think IsDust is an ideal function to be using to decide to donate to miners or not. (As dust is defined as it would cost 1/3 the outputs value in fees to spend.). I think my original formula would make more sense.

    iirc a dust amount now is like 7000 satoshis? Seems a fair bit too aggressive, but not outrageous (considering most people would want to source that output at a high feerate, not at the relayrate)

  4. fanquake added the label Wallet on May 4, 2017
  5. RHavar renamed this:
    Stop creating change outputs when not necessary [1 btc bounty]
    Stop creating change outputs when not necessary
    on May 21, 2017
  6. RHavar commented at 3:59 AM on May 21, 2017: contributor

    (If someone has already started working on this, please let me know as I'm happy to pay the 1 btc bounty previously offered. Otherwise I'm removing the bounty -- as I have finished implemented this logic in my own code, so no longer really require it in bitcoin core itself)

  7. meshcollider commented at 8:46 PM on March 11, 2018: contributor

    I believe the new coin selection algorithm tracked in #7664 addresses this

  8. jnewbery commented at 9:06 PM on April 2, 2018: member

    @RHavar - does this issue need to stay open now that #10637 is merged?

  9. meshcollider closed this on Oct 14, 2018

  10. 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-13 15:15 UTC

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