Balance calculation and coin selection should arrive at the same conclusions #26500

issue achow101 opened this issue on November 14, 2022
  1. achow101 commented at 9:26 PM on November 14, 2022: member

    Currently balance calculation and coin selection operate completely independently of each other, and have slightly different criteria for determining what outputs should be included in their respective calculations. This results in their conclusions differing from each other in various edge cases which can be very confusing to users. They should probably be unified so that computed balances match the available utxos that coin selection may choose from.

    A possible solution is to have the wallet actually track its (U)TXOs and compute the balance and available coins from that, rather than each having to iterate all txs in the wallet and try to figure out what's relevant.

  2. achow101 added the label Feature on Nov 14, 2022
  3. willcl-ark commented at 1:58 PM on November 15, 2022: member

    I noticed this when sketching out an implementation of a geteffectivebalance RPC here. I first implemented it in spend.cpp as this seemed like the natural location for it, and I could use the AvailableCoins() function, but later moved it into receive.cpp and more closely mimiced getbalance.

    If balance calculation and coin selection were unified this RPC would become even easier to implement :)

  4. fanquake deleted a comment on Nov 15, 2022
  5. MarcoFalke deleted a comment on Dec 1, 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-04-19 00:13 UTC

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