Skip to content

Coincontrol to backend - #10732

Draft
accumulator wants to merge 8 commits into
spesmilo:masterfrom
accumulator:coincontrol_to_backend
Draft

Coincontrol to backend#10732
accumulator wants to merge 8 commits into
spesmilo:masterfrom
accumulator:coincontrol_to_backend

Conversation

@accumulator

@accumulator accumulator commented Jul 2, 2026

Copy link
Copy Markdown
Member

Refactor coin control from GUI to backend, in preparation of adding coin control features to QML

Edit: Opus 5 found a number of issues (1619a75) Opus 4.8 didn't find. I've tried to resolve these but this ripples out to a bit more code than I'd like. Now analyzing the coincontrol state of master, and it finds basically the same issues pre-existing.

Short summary:

  • main_window.py:1419 docstring declares coincontrol a tri-state, and wallet layer honours it (get_spendable_coins), but GUI's utxo_list.get_spend_list collapses empty set to None, so it might inadvertendly select coins outside coincontrol if the last coin is removed from coincontrol.
  • interplay with frozen state is flaky; add_to_coincontrol frozen-filters only at insertion time. update_coincontrol_bar frozen-filters, but get_spend_list doesn't, so the status bar can understate the number and amount. Frozen coins can be spent (add to CC, freeze, send)
  • coincontrol bypasses every non-frozen filter; get_coins(**kwargs) discards all kwargs when a spend list exists, so no mature_only, nonlocal_only, confirmed_only etc. Think of funding a channel from a local, never broadcasted tx, or get_candidates_for_batching wanting a conservative coin selection but getting the unfiltered coin set.

I'm tempted to limit this PR to just the refactor to the backend, without regressing, but also without fixing all of the above issues, and incrementally fix the issues in other PRs

@accumulator
accumulator marked this pull request as draft July 2, 2026 13:53
@accumulator
accumulator force-pushed the coincontrol_to_backend branch 8 times, most recently from a7a0ab0 to 00eeab5 Compare July 3, 2026 11:33
@accumulator
accumulator marked this pull request as ready for review July 7, 2026 09:59
Move the coin control "spend set" out of the Qt UTXOList widget and into
Abstract_Wallet, so the coin selection is owned by the backend and can be
accessed more broadly and code is shared across GUIs.

- add add/remove/clear/query helpers for coin control on Abstract_Wallet
- drop coins from coin control when their coin or address is frozen
- refactor the Qt UTXOList to delegate to the wallet instead of keeping a
  local _spend_set
- move update_coincontrol_bar into the Qt main window
@accumulator
accumulator force-pushed the coincontrol_to_backend branch from 00eeab5 to 1619a75 Compare August 3, 2026 12:36
@accumulator
accumulator force-pushed the coincontrol_to_backend branch from cc3c81e to bf8e6a2 Compare August 3, 2026 13:43
@accumulator
accumulator force-pushed the coincontrol_to_backend branch from bf8e6a2 to 2765b0e Compare August 3, 2026 13:47
@accumulator
accumulator marked this pull request as draft August 3, 2026 14:16
@accumulator
accumulator force-pushed the coincontrol_to_backend branch from b70df12 to 28d77d8 Compare August 3, 2026 14:22
@accumulator
accumulator force-pushed the coincontrol_to_backend branch from f6e4092 to 1828339 Compare August 3, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant