wallet: app-owned child lifecycle + user-chosen ChainSource

The app now owns monero-wallet-rpc (and monerod when the chain source is
local) instead of requiring the user to start them and export
ONIONWIRE_WALLET_RPC.

- ChainSource enum: None / Local { monerod_bin, datadir } / Remote { host,
  port }. No default remote node; Remote is only constructed from explicit
  user input. A .onion Remote is refused without a SOCKS proxy (separate
  card).
- WalletChild in src/wallet_child.rs spawns monero-wallet-rpc with
  --rpc-bind-ip 127.0.0.1, a random free loopback port, generated
  --rpc-login, and --wallet-dir /wallet; monerod too for a
  local source. --trusted-daemon is never passed.
- Generated RPC creds are sealed in the encrypted SQLCipher store
  (wallet_child table, AEAD on top of whole-db encryption), never a
  plaintext file. The Wallet client is built from the generated loopback
  URL, not from_env.
- Readiness predicate: chain_ready() requires synchronized==true, height>0,
  height>=target_height; can_spend() and can_verify_receipts() gate on it.
  Unsynced -> receipts stay verified=0, spend refused with a clear message.
- Backend-aware timeouts: local management calls keep 5s; chain-dependent
  calls (get_info, get_transfers, transfer) get 60s (CHAIN_RPC_TIMEOUT),
  because a first sync or a remote daemon outlasts 5s and a 5s cap there
  is what left receipts permanently unverified.
- node.rs ingest_receipt gates on can_verify_receipts() instead of
  configured() alone.
- docs/WALLET.md rewritten for the child lifecycle + chain source.

Base: feat/wallet-create-import (PR #66). Do not rebase onto main.

Co-Authored-By: Hermes Agent <agent@local>
This commit is contained in:
agent 2026-09-14 18:55:07 -04:00
commit bcf7ec31c1
No known key found for this signature in database
7 changed files with 1341 additions and 60 deletions

View file

@ -1179,7 +1179,11 @@ impl Node {
.map_err(|e| e.to_string())?
};
let mut verified = false;
if self.wallet.configured() {
// Honest prerequisite: an unsynced wallet cannot see the tx, so a
// get_transfers "miss" would be a lie. Until the chain is ready the
// receipt stays verified=0 — that is the correct state, not an error.
let ready = self.wallet.configured() && self.wallet.can_verify_receipts().await;
if ready {
match self.wallet.get_transfers().await {
Ok(rows)
if wallet::transfers_match(