sdk: expose the on-device Cuprate chain source (choice, lifecycle, node status)
All checks were successful
ci / test (pull_request) Successful in 5m5s
ci / sdk (pull_request) Successful in 1m4s
android-ci / android (pull_request) Successful in 8m31s
ci / fuzz (pull_request) Successful in 4m47s

ChainChoice gains InProcessCuprate, the SDK passes the core's cuprate-daemon
feature through as its own, and an empty monerod_datadir for that kind resolves
to $ONIONWIRE_HOME/chain so Kotlin never invents a path. wallet_status now
carries chain_in_process / node_available / node_state beside the core's five
state words; no second state machine, no timer, no env var.

start/stop stay the core's pass-through: one call launches the node and the
wallet child, one stops both, both idempotent.

Replayed onto main (25e029e): PR #111 was merged into the core branch
onionwire/t_04975420-cuprate-land-the-in-process-chain-source, not main, so
main had only the core half (from PR #110). This is the same tree change with
no core commits replayed.
This commit is contained in:
agent 2026-09-18 14:34:07 -04:00
commit e89dd9eaee
No known key found for this signature in database
4 changed files with 1758 additions and 32 deletions

View file

@ -142,8 +142,8 @@ cargo build --release --features cuprate-daemon
of work. What selects this source today is a `ChainSource::InProcessCuprate`
record with a `datadir` written through `Node::set_wallet_child_config` (the
SDK's `ChainConfig` path), and the daemon then starts with the child when the
wallet is started. The SDK gains its own chain-choice variant in a follow-up
card; until then `kind = "cuprate"` is the record's spelling.
wallet is started. The SDK's `ChainChoice.InProcessCuprate` is that variant
over UniFFI, and `kind = "cuprate"` is the record's spelling.
### Chain traffic over Tor (`.onion` daemons)
@ -329,9 +329,9 @@ wallet screen (F6):
The state shown next to the wallet readouts is `off` / `connecting` / `syncing`
/ `ready` / `exited`, plus the chain-source label (`receive-only`,
`local node`, `remote onion daemon`, `remote daemon`). It is derived from the
real process (`try_wait`) and the last probe — **never** from env-var presence,
and `ready` is never reported for a child that has died.
`local node`, `in-process node`, `remote onion daemon`, `remote daemon`). It is
derived from the real process (`try_wait`) and the last probe — **never** from
env-var presence, and `ready` is never reported for a child that has died.
- **`off`** — nothing started (or stopped). The default state.
- **`connecting`** — the `monero-wallet-rpc` process is alive but has not
@ -357,7 +357,15 @@ credentials live*), so they survive a restart:
- Android (UniFFI): `set_chain_source(ChainConfig)` / `chain_source()`,
`start_wallet_child()`, `stop_wallet_child()`, `wallet_status()`. Pass
absolute paths for `wallet_rpc_bin` / `arti_bin` (`nativeLibraryDir`); the
core never resolves a binary the caller named explicitly.
core never resolves a binary the caller named explicitly. `ChainChoice` has a
fourth variant, `InProcessCuprate`, for the in-process daemon: no binary path
and, with an empty `monerod_datadir`, the SDK resolves the chain directory to
`$ONIONWIRE_HOME/chain`. `start_wallet_child()` is the whole lifecycle for it
(the core launches the node *and* the wallet child in that one call), and
`wallet_status()` carries `chain_in_process` (this app's node is the source),
`node_available` (this build has `cuprate-daemon`) and `node_state`
(`off` / `starting` / `syncing` / `ready` / `exited`, empty for every other
source) beside the core's own five `state` words.
So local mode is **available**, not wired off: a local chain source spawns
`monerod` from the path you set, a `.onion` daemon spawns the `arti` SOCKS