tui: F7 becomes the node-setup screen, and F6 goes back to being the wallet
All checks were successful
ci / test (pull_request) Successful in 7m20s
ci / sdk (pull_request) Successful in 1m45s
android-ci / android (pull_request) Successful in 13m36s
ci / fuzz (pull_request) Successful in 5m29s

The chain source was reachable from three places and configured from none of
them properly: `F6`'s inline `1`/`2`/`3` picker wrote only the in-process
choice, the `F9` menu showed the state and named keys that edited it, and
`Node::set_local_monerod` / `set_remote_daemon` / `set_receive_only` — the only
way to point the app at a Monero node — had **no TUI caller at all** (Kotlin
only). `wallet::NOT_CONFIGURED_MSG` told users to "open F7" and there was no F7.

F7 (`WalletSetupConfig`) is now the one screen that sets up the node:

- The `datadir` row is new and editable. `Node::set_local_monerod_at` takes the
  path; `set_local_monerod` delegates with the derived default, so an existing
  install keeps the store it already has. An empty datadir is refused rather
  than silently replaced — a store that moved unasked looks like a vanished
  chain and resyncs somewhere the user did not choose.
- The `network` row is new: it carries the Cuprate mainnet/testnet choice that
  `F6`'s `1`/`2`/`3` used to own, so deleting those keys loses nothing. Mainnet
  reads `unvalidated` before it is picked.
- A `NODE` section shows the live `Node::wallet_child_status` line (state, chain
  source, `sync h/t`, last error) and the last save/test answer. It is the
  node's answer, never the draft above it, and `Ctrl-R` re-reads it.
- `Ctrl-S` saves and starts the child (the daemon, and `monerod` for a local
  source); `Ctrl-X` stops it. Both go through the same `Node::start_wallet_child`
  / `stop_wallet_child` the app's own lifecycle uses, so a start that lands on a
  wallet with no stored passphrase still reaches the unlock prompt.

F6 loses the chain picker and the `s`/`x`/`p` child keys — it is the wallet
again (receive, balance, transfers, create/import) — and its footer points at
`F7 node`. The `F9` menu's `child`/`sync` rows now name `F7 ctrl-s/x` and
`F7 ctrl-r` instead of keys that no longer exist on F6. `set_cuprate_chain` and
the `p` probe handler are deleted rather than left dead.

The node's own keys are named in the body, on the section they act on: at 80
columns the footer has room for one group and the status line already spends
half the width, which is the same reason the login row names `Ctrl-U`.

Tests: six new cases in `src/tui.rs`'s `wallet_setup_config_tests` drive the real
key path and the real node — the typed datadir reaching `ChainSource::Local`, an
empty one being refused with nothing written, the live row on open, `Ctrl-S`
saving then reporting the node's own refusal, the in-process network pick
reaching the store, and F6 no longer owning keys it does not handle.
`tests/tui_spec.rs`'s menu-key check now asserts the F7 keys; the F6 keys it
asserted before no longer work.
This commit is contained in:
agent 2026-09-27 20:06:51 -04:00
commit 5cdfbacf10
No known key found for this signature in database
6 changed files with 509 additions and 106 deletions

View file

@ -89,14 +89,17 @@ The child is stopped rather than left answering `-13`, and the status reports
(`open_wallet_with_passphrase`, or the TUI/Android prompt) and it is remembered.
Nothing spawns the child at boot. `Node::start_wallet_child` is the only start
path. The desktop TUI drives it from `F6`:
path. The desktop TUI drives it from `F7` (`Ctrl-S` / `Ctrl-X`), which is also
the screen that picks the chain source:
| Key | Effect |
|---|---|
| `s` | Start the child, then probe it once. A child whose wallet file needs a passphrase opens the passphrase prompt instead of leaving every read at `-13`. |
| `x` | Stop it (idempotent). |
| `p` | Probe: is wallet RPC answering, is the chain at the tip? |
| `1` / `2` / `3` | Store in-process Cuprate as mainnet-pruned / mainnet-full / testnet. |
| `Ctrl-S` | Save the form, then start the child and probe it once. A child whose wallet file needs a passphrase opens the passphrase prompt instead of leaving every read at `-13`. |
| `Ctrl-X` | Stop it (idempotent). |
| `Ctrl-R` | Re-read the live node line (`off` / `connecting` / `syncing` / `ready` / `exited`). |
| `Enter` | Save the endpoint and chain source without dialling or starting anything. |
| `chain` row + `space` | Receive-only / local `monerod` / remote daemon / in-process Cuprate. |
| `network` row + `space` | In-process network: mainnet (unvalidated) or testnet. |
State shown: `off` / `connecting` / `syncing` / `ready` / `exited`, plus a
chain-source label, plus `wallet locked` while a catalogue wallet is configured
@ -149,9 +152,10 @@ cargo build --release --features cuprate-daemon
`this build has no in-process chain daemon — rebuild with --features cuprate-daemon`.
- **Pre-production.** Cuprate's own user book says do not use `cuprated` for
serious purposes. RPC parity is incomplete (`docs/cuprate-launch-spike.md`).
- **Mainnet is unvalidated.** The TUI can store mainnet-pruned (`F6` `1`) or
mainnet-full (`F6` `2`) or testnet (`F6` `3`). Every in-process surface still
prints `testnet only — mainnet is unvalidated` (`cuprate::TESTNET_ONLY`).
- **Mainnet is unvalidated.** The TUI stores the in-process network on `F7`'s
`network` row (mainnet or testnet) and the store's shape on its `prune` row.
Every in-process surface still prints `testnet only — mainnet is unvalidated`
(`cuprate::TESTNET_ONLY`).
Cross-compiled is not device-proven. Pointing a mainnet wallet at it is not
something this build claims to do.
- **No Tor on the chain path.** Cuprate's `arti` feature is off (arti-client
@ -208,9 +212,10 @@ be used (non-loopback, `.onion`, missing login) is reported and falls back to
env rather than dialling the bad endpoint.
`Store::save_wallet_config` / `Node::wallet_save_config` exist, and the `F7`
screen (`WalletSetupConfig`) writes them: the endpoint, its login, and the chain
source. Nothing else does — `F6` and `F9` show state, the env vars are the
headless path. The not-configured refusal says
screen (`WalletSetupConfig`) writes them: the endpoint, its login, the chain
source, and (for a local node) its datadir and network. It is also the only
screen that starts and stops the child (`Ctrl-S` / `Ctrl-X`). `F6` and `F9`
show state, the env vars are the headless path. The not-configured refusal says
`wallet not configured — open F7 to set it up, or set ONIONWIRE_WALLET_RPC`
(`src/wallet.rs`), and that key is real.