tui: F7 can save and start an app-owned chain source #170
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_fcd38efc-onionwire-tui-f7-can-save-and-start-an-a"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The defect, reproduced on a fresh install
WalletSetupConfigState::save()ran the wallet-config write first and returned early on its error, so F7 withchain= in-process Cuprate,network= testnet and an emptyurlrow wrote nothing:not saved · wallet RPC endpoint required. Typing a URL then demanded a login, and the only way to save was to invent an endpoint (http://127.0.0.1:28083/json_rpcplusu:p) that the app-owned child never dials.That refusal belongs to
Wallet::from_configand it is about an externally runmonero-wallet-rpc. An app-owned chain source (localmonerod, in-process Cuprate) spawns its own child, which generates its own creds and picks its own port, andNode::start_wallet_child_withreplaces the stored client after the spawn — so on that path theurl/loginrows describe an endpoint the app never dials.Which save outcomes are allowed now
saved · not dialled yet — ctrl-s starts it, ctrl-t tests the endpoint(unchanged).not saved · wallet config: WHY · chain source: WHY, one line shape either way round, and the half that wrote says so. Both halves are attempted on every save, so a wallet-RPC refusal can no longer silently drop a chain source the user just picked.url(ChainSource::Local,ChainSource::InProcessCuprate) — the endpoint question is not asked; the chain source is written and the save reportssaved. Nothing is written to the wallet config on that path, and the stored one is left as it was.Wallet::from_config/Node::wallet_save_configare untouched: a storedrpc_urlwithout credentials is a broken config and the SDK/UniFFI path depends on that check. What changed is what the screen demands, not what the validator accepts.daemon) — writes nothing for the chain, and now reports the wallet half's outcome on the same line instead of dropping it.The chain row in a build without
cuprate-daemonWalletSetupConfigState::chain_display()mirrorsprune_display()/network_display(): for the in-process pick it appendscrate::cuprate::NO_FEATURE_MSG—this build has no in-process chain daemon — rebuild with --features cuprate-daemon— clamped to the frame width by the existingfit_cellspath. The pick stays in the picker: builds with the feature exist, and a stored in-process source must still be readable.Start-failure contract chosen: all or nothing
A start that fails part way stops whatever that call spawned — the in-process daemon, a spawned
monerod, the SOCKS child, the wallet RPC — before the error is handed back. Why that is right for an in-process daemon too:Node::start_wallet_child_withreturnsErrand drops theWalletChild, so a daemon left running has no owner and no handle; nothing in the app could stop or reuse it.18081and getwallet child already runningfrom the retry, so keeping it buys nothing and can wedge the nextctrl-s.CuprateNode's ownDropalso shuts the daemon down cleanly, so nothing is silently leaked.node::tests::a_missing_binary_fails_the_start_and_leaves_no_child, which is deliberate and was left untouched.src/wallet_child.rsalready behaved that way, so this change states the contract where the stop happens and makes both tests express it. The red test was red because its fakemonero-wallet-rpcnever binds the port its own readiness gate probes:start()returned that error, the test discarded it withlet _ =, and then asserted the daemon had survived a failed start. It now holds the published port the way the module's other start tests do (test_support::PublishedPortHold) and expects the start to succeed; every assertion it had is kept. The failure path gets its own test instead (a_start_that_fails_after_the_daemon_came_up_leaves_nothing_running).Scope and siblings
src/tui.rs,src/wallet_child.rs,docs/TUI.md,docs/WALLET.md(tests live insrc/). No forbidden file was modified.t_35a220ddownsmonero-wallet-rpcpath resolution (a binary resolved beside the app rather than a bare name onPATH) plussrc/node.rs. Nothing here touches that; the end-to-end run below relied onmonero-wallet-rpcbeing onPATHon this host. That card also editsdocs/WALLET.md, so a small conflict there is expected when it lands.Evidence
End to end, real TUI, fresh
ONIONWIRE_HOME,--features cuprate-daemonF7 →
chain= in-process (3 spaces),network= testnet,urlandloginleft empty,Ctrl-S:Ctrl-X→node child off · in-process testnet, andss -ltn | grep 18081returns nothing.Not exercised
mainnet (the in-process daemon is testnet-only in this tree), a real
.onionchain daemon, Android, a funded wallet, a--releasebuild, and any wallet file actually created in the child (the run reachedNo wallet file, which is the expected state on a home with no wallet yet).