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

@ -22,11 +22,11 @@ ASCII chrome.
| `Wipe` | `/wipe` or `/wipe-all` | Type `WIPE` or `WIPEALL` |
| `Profile` | `/profile` | Edit name, bio, optional Monero address |
| `ConfirmKeys` / `Passphrase` | `/backup`, `/restore` | Type `BACKUP`/`RESTORE`, then passphrase |
| `Wallet` | `F6` | Receive QR, balance, transfers, child, chain source |
| `Wallet` | `F6` | Receive QR, balance, transfers |
| `WalletSelect` | `F6` `w` | Saved wallets, pick one or create one |
| `WalletSetup` | `F6` `c` / `i`, or `/wallet create` / `import` | Spend warning, seed, optional seed-offset passphrase, import |
| `WalletsSettings` | `F9` or `/settings` | Discovery menu (does not replace F-keys) |
| `WalletSetupConfig` | `F7` | Wallet RPC endpoint and chain source, editable |
| `WalletSetupConfig` | `F7` | Node & wallet setup: RPC endpoint, chain source, start/stop, live node state |
| `PeerPayments` | F9 then `p` | Peer-scoped `/pay` / `/tip` history |
| `Quit` | `Ctrl-Q` | Type `CLEAR` or `QUIT` |
@ -42,7 +42,7 @@ peer-payments are:
| `F4` | Rotate | Onion locator |
| `F5` | Who | Selected friend's profile |
| `F6` | Wallet | Wallet screen |
| `F7` | Setup | Wallet RPC endpoint and chain source |
| `F7` | Setup | Node & wallet setup: RPC endpoint, chain source, start/stop |
| `F8` | RotatePrekey | Prekey hard cut |
| `F9` | OpenMenu | Wallets & settings |
@ -115,10 +115,14 @@ in both, and the `F9` beside it is left bare so the whole hint still fits at 80.
## Wallet (`F6`)
The wallet, not the node: receive, balance, transfers, and create/import. Chain
and node configuration is `F7` (`Configures the wallet RPC endpoint and the
chain source`), named in the footer so the key is findable from here.
Footer:
```
c create i import r qr w wallets s/x child 1 pruned 2 full 3 testnet Esc back ? help
c create i import r qr w wallets F7 node Esc back ? help
```
| Key | Effect |
@ -127,14 +131,14 @@ c create i import r qr w wallets s/x child 1 pruned 2 full 3 testnet Esc
| `w` | Saved wallets (`WalletSelect`) |
| `c` | Create wallet (`SPEND` then seed once, type `SEEN`) |
| `i` | Import 25-word seed |
| `s` | Start app-owned wallet child |
| `x` | Stop child (idempotent) |
| `p` | Probe child (RPC answering? chain at tip?) |
| `1` | In-process Cuprate **mainnet pruned** (unvalidated) |
| `2` | In-process Cuprate **mainnet full** (unvalidated) |
| `3` | In-process Cuprate **testnet** |
| `F7` | Node & wallet setup (`WalletSetupConfig`) |
| Esc | Back to Main |
The child's state and the chain source are shown here (and on `F9`), but they are
**set** on `F7`: the start/stop/probe keys and the `1`/`2`/`3` in-process picker
that used to live on this screen are gone, so there is one place that configures
the chain.
The chain line for an in-process source always carries
`testnet only — mainnet is unvalidated` (`cuprate::TESTNET_ONLY`). Starting
Cuprate needs `--features cuprate-daemon`; without it, start fails with that
@ -176,17 +180,19 @@ stored identity and locator are catalogue columns, not session state: a locator
rotates (`F4`) and identity is the roster key the node already holds, so the
live header keeps reading them from the node.
## Wallet setup (`F7`)
## Node & wallet setup (`F7`)
Footer: `Esc back Enter save Ctrl-T test` (plus the status line's own `? help`).
The compactor drops tokens from the front, and at 80 columns the status line
leaves about 25 cells, so the tail is what the default terminal shows. `Tab` and
`?` are universal; `Ctrl-U` is named on the login row it clears.
`?` are universal; the node's own keys (`ctrl-s`, `ctrl-x`, `ctrl-r`) and
`Ctrl-U` are named in the body, on the row they act on.
Live from Main, the `F9` settings menu, and peer payments; the menu's `endpoint`
row names `F7` as the key that edits it. Body is `WalletSetupConfigState`, a
snapshot taken when the screen opens — the render path never reads the store.
Two things live here: the wallet RPC endpoint, and the chain source.
This is the only screen that sets up the chain: the wallet RPC endpoint, and the
node that serves it.
| Row | Kind | Notes |
|---|---|---|
@ -196,30 +202,44 @@ Two things live here: the wallet RPC endpoint, and the chain source.
| `chain` | picker | `space` cycles receive-only, local node, remote daemon, in-process |
| `daemon` | text | `host:port`, for the remote daemon |
| `monerod` | text | the binary this box spawns for a local node |
| `datadir` | text | where the chain is stored. Prefilled with the path already in use; an empty one is refused rather than silently defaulted |
| `prune` | toggle | local and in-process sources |
| `network` | picker | in-process source: `space` cycles mainnet (`unvalidated`) and testnet |
`Enter` saves and answers on the status row: `saved · not dialled — ctrl-t tests`
`the endpoint`, or the node's own refusal in its own words. The endpoint is
validated by `Node::wallet_save_config` — loopback host, login required — and a
rejected form is rejected **before** it is written: nothing in the sealed record
moves and a running wallet is not re-dialled. `Ctrl-T` dials the endpoint and
answers with the sanitized `PingResult` line (never the password). `Ctrl-U`
clears the focused field, which is how a hidden login gets replaced.
Under them, a `NODE` section: the live `Node::wallet_child_status` line (state,
chain source, `sync h/t` once a daemon reports numbers, the last error) and the
last save/test answer. The live row is the node's answer, never the draft above
it, and it is re-read by `Ctrl-R`.
The chain row is written only when it was changed. An untouched row leaves
whatever `F6`'s `1`/`2`/`3` picker stored, so opening `F7` to fix a port cannot
silently undo the in-process choice. Picking a remote daemon says so in the same
frame — `a daemon you do not run sees this wallet's chain traffic` — because that
is the pick that moves chain trust off this box. The address must parse as
`host:port` first.
`Enter` saves and answers on the status row: `saved · not dialled yet — ctrl-s
starts it, ctrl-t tests the endpoint`, or the node's own refusal in its own
words. The endpoint is validated by `Node::wallet_save_config` — loopback host,
login required — and a rejected form is rejected **before** it is written:
nothing in the sealed record moves and a running wallet is not re-dialled.
`Ctrl-T` dials the endpoint and answers with the sanitized `PingResult` line
(never the password). `Ctrl-U` clears the focused field, which is how a hidden
login gets replaced.
`Ctrl-S` saves and then starts the wallet child — the daemon and, for a local
source, `monerod` — so the setup screen is also the key that brings the node up.
A start that lands on a wallet file with no stored passphrase moves the app to
the unlock prompt. `Ctrl-X` stops the child. Both go through the same
`Node::start_wallet_child` / `stop_wallet_child` the app's own lifecycle uses.
The chain row is written only when it was changed. An untouched row leaves the
stored source alone, so opening `F7` to fix a port cannot silently undo an
in-process Cuprate choice or move a chain datadir. Picking a remote daemon says
so in the same frame — `a daemon you do not run sees this wallet's chain
traffic` — because that is the pick that moves chain trust off this box. The
address must parse as `host:port` first.
Esc is the single exit and wipes the login buffer (`Zeroizing<String>`).
## Wallets & settings (`F9` / `/settings`)
Discovery layer, not a replacement. Function keys stay live on this screen.
Rows name the shortcut they sit beside (`F6 c`, `F6 i`, `F6 r`, `F6 s/x`,
`F6 p`, `/profile`, `/backup`, `/wipe`, …).
Rows name the shortcut they sit beside (`F6 c`, `F6 i`, `F6 r`, `/profile`,
`/backup`, `/wipe`, …).
- **No credentials** on this screen. Login, seed, and passphrase are never
passed into the menu snapshot.
@ -232,9 +252,10 @@ The menu **shows** endpoint state; it does not edit it. The `endpoint` row names
copy in `src/wallet.rs` now points at — that error is no longer advice for a key
that does not exist.
Chain source is stored via `Node::set_wallet_child_config`. `F6` keys
`1`/`2`/`3` set the in-process source; `F7` sets any of the four, plus the
external RPC URL and a remote daemon host.
Chain source is stored via `Node::set_wallet_child_config`. `F7` is the one
screen that sets any of the four sources — receive-only, a local `monerod`, a
remote daemon, or the in-process Cuprate node — along with the external RPC URL
and the chain datadir.
## Peer payments (`F9` then `p`)