Review round 1 (artifact lens) on PR #91 found two defects.
1. `spawn_without_monerod_on_path_is_a_clear_error` passed
`Some(OsStr::new(""))` as the search path. `std::env::split_paths("")`
yields ONE empty element, so `find_in` probed the relative path
`monerod` in the test's cwd and passed only because the crate root
happened to hold no such file. Point it at an empty temp dir instead,
which is what the card's "test by pointing PATH empty" asked for.
Verified RED first: with an executable `./monerod` planted in the
crate root, the old test fails
("spawn monerod: No such file or directory") and the new one passes
with that same file still present.
2. The docs claimed a wiring the code does not perform:
"The wallet child is pointed at that RPC with --daemon-address
127.0.0.1:18089". Nothing points anything — `--daemon-address` exists
in `src/` only inside comments, and `Node::monerod_rpc_addr()` has no
caller. docs/WALLET.md now tells the operator to point their own
wallet child at the loopback RPC and says the address is only exposed
programmatically. The same overclaim in the `monerod_rpc_addr` doc
comment in src/node.rs is corrected too.
Also one module-doc line for the non-blocking note: a port-liveness
check cannot tell whose port it is, so a pre-existing listener on 18089
yields Ok for a child that failed to bind.
docs/WALLET.md §Chain source offered "spawn a local monerod (pruned
on-device)" but nothing implemented it. Add src/monerod.rs: find monerod
on PATH, mkdir $ONIONWIRE_HOME/monero at 0700, spawn it with
--prune-blockchain --non-interactive and its RPC bound to 127.0.0.1:18089,
poll the port for readiness, and stop it with SIGTERM (SIGKILL after 10s).
Locks held: loopback-only RPC, no --trusted-daemon, no SOCKS, no C-tor,
no clearnet default, no UDP, no new dependency (std only — SIGTERM goes
through kill(1) because the crate takes no libc). A missing binary or a
port that never answers is an Err the node logs and shrugs off: no local
chain is the honest state, not a crash.
Node wires it opt-in via ONIONWIRE_MONEROD=1: start_monerod spawns on a
blocking task during start_with_passphrase, shutdown() takes the daemon
and stops it off the reactor, and monerod_rpc_addr() reports where the
wallet child should point --daemon-address.
Tests (7, in-module): argv is pruned/loopback and carries no forbidden
flag; PATH lookup needs an executable; empty PATH and a missing binary
both Err with a clear message (and the data dir is 0700); default addr is
127.0.0.1:18089; wait_for_ready times out against a dead port; a fake
daemon spawns, reports its addr, and stops via SIGTERM (its pid is gone).
/ wallet create generates a wallet on the RPC and shows the 25-word seed
once for backup; /wallet import is the only path that takes an existing
seed, and it is collected on a dedicated screen so it never reaches the
composer line or chat history.
Threat model now states the real policy: payments are opt-in, default is
no spend key, spend is a local authority at create/restore, and the chain
source is the user's choice (spawned local monerod or a daemon address
they supply). WALLET.md and README follow.
Tests: canned-RPC create/restore, slash parse, help overlay.
/tip needs monero-wallet-rpc `transfer`, which a view-only wallet cannot do.
With ONIONWIRE_WALLET_NO_SPEND=1 (`1`/`true`/`yes`/`on`) `Wallet::transfer`
refuses locally, before any RPC dial, and /pay + receipt verification are
unchanged.
When a transfer does fail, ask the documented signal before surfacing the raw
wallet error: `query_key` key_type=spend_key answers
WALLET_RPC_ERROR_CODE_WATCH_ONLY (-29) on a view-only wallet
(wallet_rpc_server.cpp on_query_key). Both paths return one sentence —
"wallet is in view-only/no-spend mode — /tip is disabled; /pay and receipt
verification still work". Fail closed: if the probe cannot answer, the wallet's
own error stands; no fabricated detection.
New docs/WALLET.md: --generate-from-view-key / generate_from_keys watch-only
setup, --rpc-login Digest, why loopback still needs auth, the local
spend-authority warning, and the detection trade-off (a spend-capable wallet
answers the probe with its spend key, which is discarded). Linked from
docs/THREAT_MODEL.md.