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

@ -60,8 +60,8 @@ mod imp {
use std::path::Path;
use std::sync::mpsc;
use cuprated::config::{resolve_max_memory, Config};
use cuprated::Node;
use cuprated::config::{Config, resolve_max_memory};
/// The network this daemon runs. Testnet, deliberately — see the module
/// docs. Cuprate spells this `Testnet`.
@ -107,8 +107,13 @@ mod imp {
/// Blocking this thread for the duration of the launch is the same thing
/// the app already does for a `.onion` chain source's SOCKS readiness
/// wait.
pub fn launch(datadir: &Path, port: u16) -> Result<Self, String> {
let text = config_toml(datadir, port);
pub fn launch(
datadir: &Path,
port: u16,
network: &str,
prune: bool,
) -> Result<Self, String> {
let text = config_toml(datadir, port, network, prune);
let (tx, rx) = mpsc::channel();
std::thread::Builder::new()
.name("onionwire-cuprate".into())
@ -193,10 +198,10 @@ mod imp {
/// default silently standing in for the setting that was meant.
///
/// No data directory is created here — the caller owns the 0700 wallet dir.
pub fn config_toml(datadir: &Path, port: u16) -> String {
pub fn config_toml(datadir: &Path, port: u16, network: &str, prune: bool) -> String {
let datadir = datadir.display();
format!(
r#"network = "{NETWORK}"
r#"network = "{network}"
offline = false
fast_sync = true
target_max_memory = {TARGET_MAX_MEMORY}
@ -209,6 +214,9 @@ cache_directory = "{datadir}/cache"
[storage]
reader_threads = {READER_THREADS}
[storage.blockchain]
prune = {prune}
# The unrestricted listener: this is the one the wallet child dials, and the one
# with real numbers. The restricted listener is off — its metrics are
# placeholders, and nothing in this app reads them.
@ -247,9 +255,13 @@ mode = "Auto"
/// between revisions is a hard error, not a silently ignored setting.
#[test]
fn the_config_parses_into_this_revision() {
let mut config: Config =
toml::from_str(&config_toml(Path::new("/tmp/onionwire-chain"), 18081))
.expect("the config must parse against the pinned cuprated revision");
let mut config: Config = toml::from_str(&config_toml(
Path::new("/tmp/onionwire-chain"),
18081,
"Testnet",
false,
))
.expect("the config must parse against the pinned cuprated revision");
resolve_max_memory(&mut config).expect("target_max_memory is set, so nothing to probe");
assert_eq!(format!("{:?}", config.network), NETWORK);
// The fjall store is Cuprate's, under the datadir it was given —
@ -278,7 +290,12 @@ mod imp {
impl CuprateNode {
/// Always fails: this build has no in-process daemon.
pub fn launch(_datadir: &Path, _port: u16) -> Result<Self, String> {
pub fn launch(
_datadir: &Path,
_port: u16,
_network: &str,
_prune: bool,
) -> Result<Self, String> {
Err(super::NO_FEATURE_MSG.into())
}
@ -295,4 +312,4 @@ mod imp {
pub use imp::CuprateNode;
#[cfg(feature = "cuprate-daemon")]
pub use imp::{NETWORK, config_toml};
pub use imp::{config_toml, NETWORK};