wallet: wire the app-owned child into the node and TUI

The module was dead code: nothing started the child, so the payment spines
could only ever see an env-configured monero-wallet-rpc. Now:

- Node::start_wallet_child / stop_wallet_child / wallet_child_status /
  wallet_child_refresh / wallet_child_config / set_wallet_child_config. The
  start path honours the configured absolute binary path, points the node's
  wallet at the child, and shutdown() stops the child rather than orphaning
  a spend-capable RPC behind a loopback socket.
- The status is derived from the real process (try_wait) and the last probe:
  off / connecting / syncing / ready / exited, plus the chain-source label.
  A dead child is never reported ready.
- ChildConfig (source, wallet_rpc_bin, arti_bin, wallet_filename) persists in
  the sealed wallet_child record next to the generated creds; the record is a
  read-modify-write so first-start creds never clobber a saved config.
- TUI: F6 gains s (start) / x (stop) / p (probe) and a child status row, and
  the /pay and /tip key handlers now call the core readiness guard before
  sending.
This commit is contained in:
agent 2026-09-18 09:28:11 -04:00
commit 440a37caf0
No known key found for this signature in database
5 changed files with 1056 additions and 33 deletions

View file

@ -46,6 +46,35 @@ pub enum ChainSource {
},
}
impl ChainSource {
/// Does this source name a Tor onion service? Only a `.onion` daemon needs
/// the SOCKS child; a loopback or clearnet host the user typed does not.
pub fn is_onion(&self) -> bool {
match self {
ChainSource::Remote { host, .. } => is_onion_host(host),
_ => false,
}
}
/// Short label for a status line: what the wallet child is dialling.
pub fn label(&self) -> String {
match self {
ChainSource::None => "receive-only".to_string(),
ChainSource::Local { .. } => "local node".to_string(),
ChainSource::Remote { host, .. } if is_onion_host(host) => {
"remote onion daemon".to_string()
}
ChainSource::Remote { .. } => "remote daemon".to_string(),
}
}
}
/// Does this host name a Tor onion service? Case-insensitive, and it needs the
/// suffix — `notonion.example` is not one.
pub fn is_onion_host(host: &str) -> bool {
host.trim().to_ascii_lowercase().ends_with(".onion")
}
/// Remote-mode wallet config: the `monero-wallet-rpc` the user already runs
/// themselves (F7 sets it, the store keeps it, env is the migration path).
///