Make coinselection aware of maxtxfee #14928

issue madeken opened this issue on December 11, 2018
  1. madeken commented at 6:56 PM on December 11, 2018: none

    The maxtxfee check is applied at the very final stage of creating a transaction, which with a large amount of inputs and/or a low maxtxfee setting will cause coinselection to frequently propose a solution that will just be rejected, even though there are many other possible selections which would not exceed the maxtxfee setting.

    The simplest fix I believe would be make each "stage" of the coin selection aware of the maxtxfee setting, and go to the next when it can't satisfy it.

    e.g. if the BnB algorithm can find a selection that requires 0.01 BTC of fees, but the maxtxfee is set to 0.005, it shouldn't bother suggesting it.

    And then there could be a final fallback algorithm that is an extremely simple greedy one that picks the largest inputs, where if that fails then there is no hope and an error given.

  2. promag commented at 11:19 PM on December 11, 2018: member

    The "simplest fix" you suggest is to add backtracking to coin selection right?

    e.g. if the BnB algorithm can find a selection that requires 0.01 BTC of fees, but the maxtxfee is set to 0.005, it shouldn't bother suggesting it.

    In that case is it possible to have less than 0.01? AFAICT the algorithm aims for a minimal fee.

  3. fanquake added the label Wallet on Dec 12, 2018
  4. madeken commented at 5:45 PM on December 12, 2018: none

    In that case is it possible to have less than 0.01? AFAICT the algorithm aims for a minimal fee.

    Yeah. I don't believing minimizing fee is currently an objective of any stage of the current coin selection (although I would definitely appreciate an option to pick that behavior!).

  5. MarcoFalke commented at 11:29 PM on May 11, 2020: member

    maxtxfee is mostly a belt-and-suspenders check to avoid mishaps. It wasn't designed to be used for coin selection.

  6. MarcoFalke closed this on May 11, 2020

  7. MarcoFalke locked this on Feb 15, 2022
Labels

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-21 15:15 UTC

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