Skip to content

Refactor Coin Control - #3617

Draft
malik1004x wants to merge 6 commits into
devfrom
cw-1637-coin-control-refactor
Draft

Refactor Coin Control#3617
malik1004x wants to merge 6 commits into
devfrom
cw-1637-coin-control-refactor

Conversation

@malik1004x

@malik1004x malik1004x commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Issue Number (if Applicable): Fixes #

Description

The Coin Control feature suffered from numerous issues in recent time stemming from desynced, duplicated state or persisting information that should have never been persisted. This PR refactors the feature to minimize duplicated state across the feature as well as remove the dependency on MobX and Hive.

  • The UnspentInfo Hive Box has been completely removed. Its only two rows that were actually required to be persistent for this feature - the coin freeze status and the coin notes - were placed in SQLite tables.
  • The selection of outputs no longer depends on a separate viewmodel and is instead done by passing a CoinSelection object to createTransaction. This means there is no chance of the coin selection persisting across transaction creations (previously, the coin selection was explicitly reset when pressing "Send" on the Home page).
  • For all wallet types except Monero, the coin freeze function will save the freeze status in SQLite and does not store it in-memory to avoid state duplication.
  • For Monero wallets, wallet2's built-in freeze functions are used, but the selection is also cached in-memory to avoid performance issues (this is necessary because Monero's getCoin is an expensive operation, and calling it every time the freeze status was checked could cause lag).

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods
  • Manual tests in accessibility mode (TalkBack on Android) passed

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