feat(wallet): mainnet pruned and full on-device chain modes
All checks were successful
ci / test (pull_request) Successful in 5m45s
ci / sdk (pull_request) Successful in 1m34s
ci / fuzz (pull_request) Successful in 4m51s
android-ci / android (pull_request) Successful in 13m2s

Cuprate in-process and TUI keys 1/2/3 pick mainnet pruned, mainnet
full, or experimental testnet. Datadirs are split so a prune store
cannot mix with a full one. Android storage floors scale with the
choice. Cuprate remains pre-production; mainnet is unvalidated.
This commit is contained in:
agent 2026-09-19 12:54:35 -04:00
commit 5080652e3b
No known key found for this signature in database
11 changed files with 397 additions and 77 deletions

View file

@ -19,6 +19,31 @@ impl std::fmt::Display for Error {
impl std::error::Error for Error {}
/// Which Monero network an on-device daemon follows.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ChainNetwork {
Mainnet,
Testnet,
}
impl ChainNetwork {
/// Cuprate TOML `network = "..."` spelling (`Mainnet` / `Testnet`).
pub fn cuprate_toml(self) -> &'static str {
match self {
Self::Mainnet => "Mainnet",
Self::Testnet => "Testnet",
}
}
/// Directory segment so mainnet and testnet stores never share a fjall dir.
pub fn dir_name(self) -> &'static str {
match self {
Self::Mainnet => "mainnet",
Self::Testnet => "testnet",
}
}
}
/// The user's choice of where the Monero daemon lives. No default remote node
/// is ever implied — every `Remote` is constructed from explicit user input.
///
@ -34,17 +59,21 @@ pub enum ChainSource {
monerod_bin: PathBuf,
/// Data directory for the local daemon.
datadir: PathBuf,
/// `monerod --prune-blockchain`. Full node when false.
prune: bool,
},
/// A chain daemon **inside this process** (Cuprate), with its chain in
/// `datadir`. Nothing is spawned; the wallet child still dials loopback
/// RPC, so this is a [`ChainSource::Local`] with a different owner.
///
/// Two consequences the UI has to state: the chain is on this device, and
/// the in-process daemon is **testnet-only** in this build (Cuprate is
/// pre-production and its mainnet RPC parity is unvalidated).
/// Cuprate is still pre-production: mainnet RPC parity is unvalidated.
/// The UI must say so. `network`/`prune` are the user's choice; old
/// stored records without those keys are testnet, unpruned.
InProcessCuprate {
/// Data directory for the daemon's chain database.
datadir: PathBuf,
network: ChainNetwork,
prune: bool,
},
/// A daemon address the user supplied. Trust follows the address.
Remote {
@ -71,8 +100,22 @@ impl ChainSource {
pub fn label(&self) -> String {
match self {
ChainSource::None => "receive-only".to_string(),
ChainSource::Local { .. } => "local node".to_string(),
ChainSource::InProcessCuprate { .. } => "in-process node".to_string(),
ChainSource::Local { prune: true, .. } => "local pruned node".to_string(),
ChainSource::Local { prune: false, .. } => "local full node".to_string(),
ChainSource::InProcessCuprate {
network: ChainNetwork::Mainnet,
prune: true,
..
} => "in-process mainnet pruned".to_string(),
ChainSource::InProcessCuprate {
network: ChainNetwork::Mainnet,
prune: false,
..
} => "in-process mainnet full".to_string(),
ChainSource::InProcessCuprate {
network: ChainNetwork::Testnet,
..
} => "in-process testnet".to_string(),
ChainSource::Remote { host, .. } if is_onion_host(host) => {
"remote onion daemon".to_string()
}