feat(wallet): mainnet pruned and full on-device chain modes #125
11 changed files with 397 additions and 77 deletions
feat(wallet): mainnet pruned and full on-device chain modes
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.
commit
5080652e3b
|
|
@ -724,6 +724,8 @@ class WireViewModel(app: Application) : AndroidViewModel(app) {
|
|||
// an onion daemon outright while no `arti` is bundled.
|
||||
artiBin = expectedArtiPath(),
|
||||
walletFilename = WalletChildBinaries.WALLET_FILENAME,
|
||||
mainnet = false,
|
||||
prune = false,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -752,6 +754,8 @@ class WireViewModel(app: Application) : AndroidViewModel(app) {
|
|||
walletRpcBin = bins.walletRpc.orEmpty(),
|
||||
artiBin = expectedArtiPath(),
|
||||
walletFilename = WalletChildBinaries.WALLET_FILENAME,
|
||||
mainnet = false,
|
||||
prune = false,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -767,12 +771,14 @@ class WireViewModel(app: Application) : AndroidViewModel(app) {
|
|||
* is what launches the node *and* the wallet child (one call in the core).
|
||||
*
|
||||
* `monerodDatadir` is left empty on purpose: the SDK resolves that to
|
||||
* `$ONIONWIRE_HOME/chain`, the same per-identity directory a spawned `monerod`
|
||||
* would use, so Kotlin never invents an absolute path. `monero-wallet-rpc` is
|
||||
* still required — Cuprate has no wallet layer, so the subprocess stays, and the
|
||||
* core rejects a config without it.
|
||||
* `$ONIONWIRE_HOME/chain/{testnet,mainnet-pruned,mainnet-full}` from
|
||||
* [mainnet] and [prune], so Kotlin never invents an absolute path.
|
||||
*/
|
||||
suspend fun setInProcessCuprate(bins: WalletChildBinaryPaths): Result<Unit> =
|
||||
suspend fun setInProcessCuprate(
|
||||
bins: WalletChildBinaryPaths,
|
||||
mainnet: Boolean,
|
||||
prune: Boolean,
|
||||
): Result<Unit> =
|
||||
withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
requireWire().setChainSource(
|
||||
|
|
@ -787,6 +793,8 @@ class WireViewModel(app: Application) : AndroidViewModel(app) {
|
|||
// clearnet, so the core never spawns the SOCKS child.
|
||||
artiBin = expectedArtiPath(),
|
||||
walletFilename = WalletChildBinaries.WALLET_FILENAME,
|
||||
mainnet = mainnet,
|
||||
prune = prune,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,9 +318,8 @@ const val STARTING_CHILD_NOTICE: String =
|
|||
*/
|
||||
const val CUPRATE_PREPRODUCTION_WARNING: String =
|
||||
"On-device node is Cuprate, which is pre-production: its own user book says do NOT use " +
|
||||
"cuprated for any serious purposes, it runs testnet only here (mainnet is unvalidated), " +
|
||||
"and its monerod RPC parity is incomplete (Cuprate issue #278). Try the in-process " +
|
||||
"path; do not hold funds on it."
|
||||
"cuprated for any serious purposes, mainnet is unvalidated, and its monerod RPC parity " +
|
||||
"is incomplete (Cuprate issue #278). Try the in-process path; do not hold funds on it."
|
||||
|
||||
/**
|
||||
* This build was compiled without the `cuprate-daemon` feature, so the stored
|
||||
|
|
@ -342,18 +341,36 @@ const val CUPRATE_NOT_IN_BUILD_NOTICE: String =
|
|||
* measured honestly is the free space on the filesystem the fjall store grows
|
||||
* into, and the device can be told when that is not enough.
|
||||
*/
|
||||
const val CHAIN_FREE_SPACE_FLOOR_BYTES: Long = 3L * 1024 * 1024 * 1024
|
||||
const val CHAIN_TESTNET_FLOOR_BYTES: Long = 3L * 1024 * 1024 * 1024
|
||||
const val CHAIN_MAINNET_PRUNED_FLOOR_BYTES: Long = 64L * 1024 * 1024 * 1024
|
||||
const val CHAIN_MAINNET_FULL_FLOOR_BYTES: Long = 280L * 1024 * 1024 * 1024
|
||||
|
||||
/** Testnet floor, kept so existing tests still name one constant. */
|
||||
const val CHAIN_FREE_SPACE_FLOOR_BYTES: Long = CHAIN_TESTNET_FLOOR_BYTES
|
||||
|
||||
fun chainStorageFloorBytes(mainnet: Boolean, prune: Boolean): Long = when {
|
||||
!mainnet -> CHAIN_TESTNET_FLOOR_BYTES
|
||||
prune -> CHAIN_MAINNET_PRUNED_FLOOR_BYTES
|
||||
else -> CHAIN_MAINNET_FULL_FLOOR_BYTES
|
||||
}
|
||||
|
||||
/**
|
||||
* What the chain store costs, in the user's terms: the free space this device
|
||||
* actually has, and what the node does *not* tell us.
|
||||
*/
|
||||
fun chainStorageLine(freeBytes: Long?): String = when {
|
||||
freeBytes == null ->
|
||||
"chain store: free space on this device could not be read."
|
||||
else ->
|
||||
"chain store: ${formatBytes(freeBytes)} free on this device — a synced testnet store " +
|
||||
"grows into it. The node reports no size estimate of its own."
|
||||
fun chainStorageLine(freeBytes: Long?, mainnet: Boolean = false, prune: Boolean = false): String {
|
||||
val kind = when {
|
||||
!mainnet -> "a synced testnet store"
|
||||
prune -> "a pruned mainnet store (tens of GiB)"
|
||||
else -> "a full mainnet store (hundreds of GiB)"
|
||||
}
|
||||
return when {
|
||||
freeBytes == null ->
|
||||
"chain store: free space on this device could not be read."
|
||||
else ->
|
||||
"chain store: ${formatBytes(freeBytes)} free on this device — $kind " +
|
||||
"grows into it. The node reports no size estimate of its own."
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -361,13 +378,20 @@ fun chainStorageLine(freeBytes: Long?): String = when {
|
|||
* may. Fail-closed on an unreadable filesystem: an unknown free space is not
|
||||
* reported as enough.
|
||||
*/
|
||||
fun chainStorageBlockedReason(freeBytes: Long?): String? = when {
|
||||
freeBytes == null ->
|
||||
"Free space on the chain store's filesystem could not be read, so it is not known to fit."
|
||||
freeBytes < CHAIN_FREE_SPACE_FLOOR_BYTES ->
|
||||
"Not enough space for the chain store: ${formatBytes(freeBytes)} free, and the " +
|
||||
"on-device node needs at least ${formatBytes(CHAIN_FREE_SPACE_FLOOR_BYTES)}."
|
||||
else -> null
|
||||
fun chainStorageBlockedReason(
|
||||
freeBytes: Long?,
|
||||
mainnet: Boolean = false,
|
||||
prune: Boolean = false,
|
||||
): String? {
|
||||
val floor = chainStorageFloorBytes(mainnet, prune)
|
||||
return when {
|
||||
freeBytes == null ->
|
||||
"Free space on the chain store's filesystem could not be read, so it is not known to fit."
|
||||
freeBytes < floor ->
|
||||
"Not enough space for the chain store: ${formatBytes(freeBytes)} free, and the " +
|
||||
"on-device node needs at least ${formatBytes(floor)}."
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -253,10 +253,10 @@ fun WalletScreen(
|
|||
.onFailure { daemonError = it.message ?: it.toString() }
|
||||
}
|
||||
},
|
||||
onInProcessNode = {
|
||||
onInProcessNode = { mainnet, prune ->
|
||||
daemonError = null
|
||||
scope.launch {
|
||||
vm.setInProcessCuprate(bins)
|
||||
vm.setInProcessCuprate(bins, mainnet, prune)
|
||||
.onFailure { daemonError = it.message ?: it.toString() }
|
||||
}
|
||||
},
|
||||
|
|
@ -617,7 +617,7 @@ private fun WalletChildCard(
|
|||
onDaemonText: (String) -> Unit,
|
||||
onSaveDaemon: () -> Unit,
|
||||
onReceiveOnly: () -> Unit,
|
||||
onInProcessNode: () -> Unit,
|
||||
onInProcessNode: (mainnet: Boolean, prune: Boolean) -> Unit,
|
||||
starting: Boolean = false,
|
||||
onStart: () -> Unit,
|
||||
onStop: () -> Unit,
|
||||
|
|
@ -630,7 +630,15 @@ private fun WalletChildCard(
|
|||
// poller, or the user would press Start having seen neither.
|
||||
val inProcess = input?.chainInProcess == true || chain?.kind == ChainChoice.IN_PROCESS_CUPRATE
|
||||
val startWhy = startBlockedReason(bins, input, onionDaemon, starting)
|
||||
?: if (inProcess) chainStorageBlockedReason(nodeFreeBytes) else null
|
||||
?: if (inProcess) {
|
||||
chainStorageBlockedReason(
|
||||
nodeFreeBytes,
|
||||
mainnet = chain?.mainnet == true,
|
||||
prune = chain?.prune == true,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val stopWhy = stopBlockedReason(input)
|
||||
|
||||
Card(
|
||||
|
|
@ -731,11 +739,25 @@ private fun WalletChildCard(
|
|||
// reads before Start.
|
||||
Spacer(Modifier.height(8.dp))
|
||||
OutlinedButton(
|
||||
onClick = onInProcessNode,
|
||||
onClick = { onInProcessNode(true, true) },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.testTag("wallet-chain-mainnet-pruned"),
|
||||
) { Text("Mainnet pruned") }
|
||||
Spacer(Modifier.height(4.dp))
|
||||
OutlinedButton(
|
||||
onClick = { onInProcessNode(true, false) },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.testTag("wallet-chain-mainnet-full"),
|
||||
) { Text("Mainnet full") }
|
||||
Spacer(Modifier.height(4.dp))
|
||||
OutlinedButton(
|
||||
onClick = { onInProcessNode(false, false) },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.testTag("wallet-chain-in-process"),
|
||||
) { Text("On-device node (Cuprate)") }
|
||||
) { Text("Testnet (experimental)") }
|
||||
|
||||
if (inProcess) {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
|
|
@ -749,7 +771,11 @@ private fun WalletChildCard(
|
|||
)
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
chainStorageLine(nodeFreeBytes),
|
||||
chainStorageLine(
|
||||
nodeFreeBytes,
|
||||
mainnet = chain?.mainnet == true,
|
||||
prune = chain?.prune == true,
|
||||
),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ class WalletChildStatusTextTest {
|
|||
assertTrue("it names the software", warning.contains("Cuprate"))
|
||||
assertTrue("it quotes the user book", warning.contains("do NOT use cuprated"))
|
||||
assertTrue("it names the parity gap", warning.contains("Cuprate issue #278"))
|
||||
assertTrue("it says testnet", warning.contains("testnet"))
|
||||
assertTrue("it says mainnet is unvalidated", warning.contains("mainnet is unvalidated"))
|
||||
assertTrue("it is a sentence, not a glyph", warning.trim().endsWith("."))
|
||||
assertTrue("it is long enough to be a sentence", warning.length > 80)
|
||||
}
|
||||
|
|
@ -364,6 +364,33 @@ class WalletChildStatusTextTest {
|
|||
assertNull(chainStorageBlockedReason(64L * 1024 * 1024 * 1024))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mainnet_pruned_needs_more_than_testnet() {
|
||||
val forty = 40L * 1024 * 1024 * 1024
|
||||
assertNull(chainStorageBlockedReason(forty, mainnet = false, prune = false))
|
||||
val why = chainStorageBlockedReason(forty, mainnet = true, prune = true)
|
||||
assertNotNull(why)
|
||||
assertTrue(why!!, why.contains("64.0 GiB"))
|
||||
assertNull(
|
||||
chainStorageBlockedReason(
|
||||
CHAIN_MAINNET_PRUNED_FLOOR_BYTES,
|
||||
mainnet = true,
|
||||
prune = true,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mainnet_full_needs_more_than_pruned() {
|
||||
val why = chainStorageBlockedReason(
|
||||
CHAIN_MAINNET_PRUNED_FLOOR_BYTES,
|
||||
mainnet = true,
|
||||
prune = false,
|
||||
)
|
||||
assertNotNull(why)
|
||||
assertTrue(why!!, why.contains("280.0 GiB"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun the_storage_line_reports_the_measured_number() {
|
||||
val line = chainStorageLine(41L * 1024 * 1024 * 1024)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use onionwire::node::{FlushOutcome as CoreFlushOutcome, Node};
|
|||
use onionwire::outbox::{DEFAULT_MAX_ATTEMPTS, OutboxEntry, OutboxStatus};
|
||||
use onionwire::pay;
|
||||
use onionwire::qr;
|
||||
use onionwire::wallet::ChainSource;
|
||||
use onionwire::wallet::{ChainNetwork, ChainSource};
|
||||
use onionwire::wallet_child::{ChildConfig, WalletChildState};
|
||||
|
||||
uniffi::setup_scaffolding!();
|
||||
|
|
@ -742,20 +742,40 @@ fn from_core_flush(o: CoreFlushOutcome) -> FlushOutcome {
|
|||
/// per-identity directory the core documents for a local chain — so a Kotlin
|
||||
/// caller never has to invent an absolute path. Every other kind uses exactly
|
||||
/// what it was given (or the core's own default), unchanged.
|
||||
fn cuprate_chain_dir(home: &Path, mainnet: bool, prune: bool) -> PathBuf {
|
||||
let name = match (mainnet, prune) {
|
||||
(true, true) => "mainnet-pruned",
|
||||
(true, false) => "mainnet-full",
|
||||
(false, _) => "testnet",
|
||||
};
|
||||
home.join("chain").join(name)
|
||||
}
|
||||
|
||||
fn child_config(cfg: ChainConfig, home: &Path) -> ChildConfig {
|
||||
let source = match cfg.kind {
|
||||
ChainChoice::None => ChainSource::None,
|
||||
ChainChoice::Local => ChainSource::Local {
|
||||
monerod_bin: PathBuf::from(cfg.monerod_bin),
|
||||
datadir: PathBuf::from(cfg.monerod_datadir),
|
||||
prune: cfg.prune,
|
||||
},
|
||||
ChainChoice::InProcessCuprate => ChainSource::InProcessCuprate {
|
||||
datadir: if cfg.monerod_datadir.trim().is_empty() {
|
||||
home.join("chain")
|
||||
ChainChoice::InProcessCuprate => {
|
||||
let network = if cfg.mainnet {
|
||||
ChainNetwork::Mainnet
|
||||
} else {
|
||||
PathBuf::from(cfg.monerod_datadir)
|
||||
},
|
||||
},
|
||||
ChainNetwork::Testnet
|
||||
};
|
||||
let prune = cfg.mainnet && cfg.prune;
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir: if cfg.monerod_datadir.trim().is_empty() {
|
||||
cuprate_chain_dir(home, cfg.mainnet, prune)
|
||||
} else {
|
||||
PathBuf::from(cfg.monerod_datadir)
|
||||
},
|
||||
network,
|
||||
prune,
|
||||
}
|
||||
}
|
||||
ChainChoice::Remote => ChainSource::Remote {
|
||||
host: cfg.host,
|
||||
port: cfg.port,
|
||||
|
|
@ -769,32 +789,42 @@ fn child_config(cfg: ChainConfig, home: &Path) -> ChildConfig {
|
|||
}
|
||||
}
|
||||
|
||||
/// And back, for the Kotlin prefill.
|
||||
fn chain_config(cfg: &ChildConfig) -> ChainConfig {
|
||||
let (kind, host, port, monerod_bin, monerod_datadir) = match &cfg.source {
|
||||
let (kind, host, port, monerod_bin, monerod_datadir, mainnet, prune) = match &cfg.source {
|
||||
ChainSource::None => (
|
||||
ChainChoice::None,
|
||||
String::new(),
|
||||
0,
|
||||
String::new(),
|
||||
String::new(),
|
||||
false,
|
||||
false,
|
||||
),
|
||||
ChainSource::Local {
|
||||
monerod_bin,
|
||||
datadir,
|
||||
prune,
|
||||
} => (
|
||||
ChainChoice::Local,
|
||||
String::new(),
|
||||
0,
|
||||
monerod_bin.display().to_string(),
|
||||
datadir.display().to_string(),
|
||||
true,
|
||||
*prune,
|
||||
),
|
||||
ChainSource::InProcessCuprate { datadir } => (
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir,
|
||||
network,
|
||||
prune,
|
||||
} => (
|
||||
ChainChoice::InProcessCuprate,
|
||||
String::new(),
|
||||
0,
|
||||
String::new(),
|
||||
datadir.display().to_string(),
|
||||
matches!(network, ChainNetwork::Mainnet),
|
||||
*prune,
|
||||
),
|
||||
ChainSource::Remote { host, port } => (
|
||||
ChainChoice::Remote,
|
||||
|
|
@ -802,6 +832,8 @@ fn chain_config(cfg: &ChildConfig) -> ChainConfig {
|
|||
*port,
|
||||
String::new(),
|
||||
String::new(),
|
||||
false,
|
||||
false,
|
||||
),
|
||||
};
|
||||
ChainConfig {
|
||||
|
|
@ -813,6 +845,8 @@ fn chain_config(cfg: &ChildConfig) -> ChainConfig {
|
|||
wallet_rpc_bin: cfg.wallet_rpc_bin.display().to_string(),
|
||||
arti_bin: cfg.arti_bin.display().to_string(),
|
||||
wallet_filename: cfg.wallet_filename.clone(),
|
||||
mainnet,
|
||||
prune,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -997,6 +1031,13 @@ pub struct ChainConfig {
|
|||
pub arti_bin: String,
|
||||
/// Wallet file name inside `$ONIONWIRE_HOME/wallet`.
|
||||
pub wallet_filename: String,
|
||||
/// Cuprate / local `monerod`: mainnet when true, testnet when false.
|
||||
/// Ignored for Remote and None. Old records without the field stay testnet.
|
||||
pub mainnet: bool,
|
||||
/// Cuprate / local `monerod`: prune the chain. Ignored for Remote and None.
|
||||
/// Once a Cuprate store is pruned it cannot be un-pruned — we keep pruned
|
||||
/// and full in separate datadirs.
|
||||
pub prune: bool,
|
||||
}
|
||||
|
||||
/// One snapshot of the app-owned wallet child.
|
||||
|
|
@ -1713,6 +1754,8 @@ mod tests {
|
|||
wallet_rpc_bin: "/data/app/nativeLibraryDir/libmonerowalletrpc.so".to_string(),
|
||||
arti_bin: "/data/app/nativeLibraryDir/libarti.so".to_string(),
|
||||
wallet_filename: "wallet".to_string(),
|
||||
mainnet: false,
|
||||
prune: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1726,10 +1769,49 @@ mod tests {
|
|||
assert_eq!(
|
||||
child.source,
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir: sdk_home().join("chain")
|
||||
datadir: sdk_home().join("chain").join("testnet"),
|
||||
network: ChainNetwork::Testnet,
|
||||
prune: false,
|
||||
}
|
||||
);
|
||||
assert_eq!(child.source_label(), "in-process node");
|
||||
assert_eq!(child.source_label(), "in-process testnet");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn child_config_mainnet_pruned_uses_its_own_datadir() {
|
||||
let mut req = request(ChainChoice::InProcessCuprate, "");
|
||||
req.mainnet = true;
|
||||
req.prune = true;
|
||||
let child = child_config(req, &sdk_home());
|
||||
assert_eq!(
|
||||
child.source,
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir: sdk_home().join("chain").join("mainnet-pruned"),
|
||||
network: ChainNetwork::Mainnet,
|
||||
prune: true,
|
||||
}
|
||||
);
|
||||
assert_eq!(child.source_label(), "in-process mainnet pruned");
|
||||
let back = chain_config(&child);
|
||||
assert!(back.mainnet);
|
||||
assert!(back.prune);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn child_config_mainnet_full_uses_its_own_datadir() {
|
||||
let mut req = request(ChainChoice::InProcessCuprate, "");
|
||||
req.mainnet = true;
|
||||
req.prune = false;
|
||||
let child = child_config(req, &sdk_home());
|
||||
assert_eq!(
|
||||
child.source,
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir: sdk_home().join("chain").join("mainnet-full"),
|
||||
network: ChainNetwork::Mainnet,
|
||||
prune: false,
|
||||
}
|
||||
);
|
||||
assert_eq!(child.source_label(), "in-process mainnet full");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1739,7 +1821,9 @@ mod tests {
|
|||
assert_eq!(
|
||||
child.source,
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir: PathBuf::from(given)
|
||||
datadir: PathBuf::from(given),
|
||||
network: ChainNetwork::Testnet,
|
||||
prune: false,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -1776,7 +1860,7 @@ mod tests {
|
|||
ChainChoice::InProcessCuprate => {
|
||||
assert_eq!(
|
||||
back.monerod_datadir,
|
||||
sdk_home().join("chain").display().to_string()
|
||||
sdk_home().join("chain").join("testnet").display().to_string()
|
||||
);
|
||||
assert!(
|
||||
back.monerod_bin.is_empty(),
|
||||
|
|
@ -1815,7 +1899,9 @@ mod tests {
|
|||
#[test]
|
||||
fn node_state_names_the_apps_own_chain_for_the_in_process_source() {
|
||||
let source = ChainSource::InProcessCuprate {
|
||||
datadir: sdk_home().join("chain"),
|
||||
datadir: sdk_home().join("chain").join("testnet"),
|
||||
network: ChainNetwork::Testnet,
|
||||
prune: false,
|
||||
};
|
||||
let cases = [
|
||||
(WalletChildState::Off, "off"),
|
||||
|
|
@ -1844,6 +1930,7 @@ mod tests {
|
|||
ChainSource::Local {
|
||||
monerod_bin: PathBuf::from("monerod"),
|
||||
datadir: PathBuf::from("/chain"),
|
||||
prune: false,
|
||||
},
|
||||
ChainSource::Remote {
|
||||
host: "peer.onion".to_string(),
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
30
src/node.rs
30
src/node.rs
|
|
@ -29,7 +29,7 @@ use crate::ratelimit::TokenBucket;
|
|||
use crate::sanitize;
|
||||
use crate::session::{self, Keys};
|
||||
use crate::store::{Friend, FriendProfile, Message, Payment, PaymentWrite, Store};
|
||||
use crate::wallet::{self, Readiness, Wallet, WalletConfig, WalletStatus};
|
||||
use crate::wallet::{self, ChainNetwork, ChainSource, Readiness, Wallet, WalletConfig, WalletStatus};
|
||||
use crate::wallet_child::{ChildConfig, WalletChild, WalletChildState, WalletChildStatus};
|
||||
|
||||
pub struct RotateResult {
|
||||
|
|
@ -567,6 +567,10 @@ impl Node {
|
|||
|
||||
// ----- the app-owned wallet child (`src/wallet_child.rs`) ----------------
|
||||
|
||||
pub fn home(&self) -> &Path {
|
||||
&self.home
|
||||
}
|
||||
|
||||
/// The child settings this node would spawn with: the stored record, or the
|
||||
/// defaults (receive-only, binaries by name) when nothing was ever set.
|
||||
pub fn wallet_child_config(&self) -> ChildConfig {
|
||||
|
|
@ -593,6 +597,30 @@ impl Node {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Store an in-process Cuprate source. Datadirs are split so a pruned
|
||||
/// mainnet store cannot mix with a full one (Cuprate cannot un-prune).
|
||||
pub fn set_in_process_cuprate(
|
||||
&self,
|
||||
network: ChainNetwork,
|
||||
prune: bool,
|
||||
) -> Result<(), String> {
|
||||
let mut cfg = self.wallet_child_config();
|
||||
if cfg.wallet_rpc_bin.as_os_str().is_empty() {
|
||||
cfg.wallet_rpc_bin = PathBuf::from("monero-wallet-rpc");
|
||||
}
|
||||
let name = match (network, prune) {
|
||||
(ChainNetwork::Mainnet, true) => "mainnet-pruned",
|
||||
(ChainNetwork::Mainnet, false) => "mainnet-full",
|
||||
(ChainNetwork::Testnet, _) => "testnet",
|
||||
};
|
||||
cfg.source = ChainSource::InProcessCuprate {
|
||||
datadir: self.home.join("chain").join(name),
|
||||
network,
|
||||
prune: matches!(network, ChainNetwork::Mainnet) && prune,
|
||||
};
|
||||
self.set_wallet_child_config(&cfg)
|
||||
}
|
||||
|
||||
/// Start the app-owned wallet child and point this node's wallet at it.
|
||||
///
|
||||
/// Idempotent: a live wallet child is reported, not respawned. Spawning is
|
||||
|
|
|
|||
19
src/tui.rs
19
src/tui.rs
|
|
@ -18,7 +18,7 @@ use crate::outbox::DEFAULT_MAX_ATTEMPTS;
|
|||
use crate::qr::{self, QrPayload};
|
||||
use crate::sanitize;
|
||||
use crate::store::{Friend, FriendProfile, Message, OutboxEntry, OutboxStatus, Payment};
|
||||
use crate::wallet::{self, ChainSource};
|
||||
use crate::wallet::{self, ChainNetwork, ChainSource};
|
||||
|
||||
const C_ACCENT: Color = Color::Rgb(232, 165, 75);
|
||||
const C_TEXT: Color = Color::Rgb(196, 214, 176);
|
||||
|
|
@ -1669,6 +1669,9 @@ impl App {
|
|||
KeyCode::Char('s') => self.wallet_child_start(),
|
||||
KeyCode::Char('x') => self.wallet_child_stop(),
|
||||
KeyCode::Char('p') => self.wallet_child_probe(),
|
||||
KeyCode::Char('1') => self.set_cuprate_chain(ChainNetwork::Mainnet, true),
|
||||
KeyCode::Char('2') => self.set_cuprate_chain(ChainNetwork::Mainnet, false),
|
||||
KeyCode::Char('3') => self.set_cuprate_chain(ChainNetwork::Testnet, false),
|
||||
KeyCode::Char('c') => {
|
||||
self.screen = Screen::WalletSetup(WalletSetup::CreateWarn {
|
||||
typed: String::new(),
|
||||
|
|
@ -2142,6 +2145,16 @@ impl App {
|
|||
self.status_note = Some(self.wallet_child_note());
|
||||
}
|
||||
|
||||
fn set_cuprate_chain(&mut self, network: ChainNetwork, prune: bool) {
|
||||
self.status_note = Some(match self.node.set_in_process_cuprate(network, prune) {
|
||||
Ok(()) => format!(
|
||||
"chain source: {}",
|
||||
self.node.wallet_child_config().source.label()
|
||||
),
|
||||
Err(e) => format!("chain source: {e}"),
|
||||
});
|
||||
}
|
||||
|
||||
/// The child status line, or the copy that names what is missing.
|
||||
fn wallet_child_note(&mut self) -> String {
|
||||
let line = self.rt.block_on(self.node.wallet_child_refresh()).line();
|
||||
|
|
@ -3179,7 +3192,9 @@ match screen {
|
|||
BackupKind::Restore => "type RESTORE Esc cancel ? help",
|
||||
},
|
||||
Screen::Passphrase { .. } => "Enter submit Esc cancel ? help",
|
||||
Screen::Wallet { .. } => "c create i import r qr s/x child Esc back ? help",
|
||||
Screen::Wallet { .. } => {
|
||||
"c create i import r qr s/x child 1 pruned 2 full 3 testnet Esc back ? help"
|
||||
}
|
||||
Screen::WalletSetup(WalletSetup::CreateWarn { .. }) => "type SPEND Esc cancel ? help",
|
||||
Screen::WalletSetup(WalletSetup::CreatePass { .. } | WalletSetup::ImportPass { .. }) => {
|
||||
"Enter submit Esc cancel ? help"
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ use zeroize::Zeroizing;
|
|||
|
||||
use crate::cuprate::CuprateNode;
|
||||
use crate::store::Store;
|
||||
use crate::wallet::{self, ChainSource, Wallet};
|
||||
use crate::wallet::{self, ChainNetwork, ChainSource, Wallet};
|
||||
|
||||
/// `monerod` RPC port for a local chain source. Unrestricted RPC default; the
|
||||
/// wallet child is the only thing that dials it.
|
||||
|
|
@ -355,7 +355,7 @@ impl WalletChild {
|
|||
/// for a remote source (their disk, not ours) and for receive-only.
|
||||
pub fn chain_datadir(source: &ChainSource) -> Option<&Path> {
|
||||
match source {
|
||||
ChainSource::Local { datadir, .. } | ChainSource::InProcessCuprate { datadir } => {
|
||||
ChainSource::Local { datadir, .. } | ChainSource::InProcessCuprate { datadir, .. } => {
|
||||
Some(datadir)
|
||||
}
|
||||
ChainSource::None | ChainSource::Remote { .. } => None,
|
||||
|
|
@ -377,8 +377,8 @@ impl WalletChild {
|
|||
|
||||
/// The exact argv used to spawn `monerod`. Single source of truth: `start`
|
||||
/// spawns this and the tests assert on it.
|
||||
pub fn monerod_argv(bin: &Path, datadir: &Path, rpc_port: u16) -> Vec<String> {
|
||||
vec![
|
||||
pub fn monerod_argv(bin: &Path, datadir: &Path, rpc_port: u16, prune: bool) -> Vec<String> {
|
||||
let mut argv = vec![
|
||||
bin.display().to_string(),
|
||||
"--non-interactive".into(),
|
||||
"--data-dir".into(),
|
||||
|
|
@ -387,7 +387,11 @@ impl WalletChild {
|
|||
"127.0.0.1".into(),
|
||||
"--rpc-bind-port".into(),
|
||||
rpc_port.to_string(),
|
||||
]
|
||||
];
|
||||
if prune {
|
||||
argv.push("--prune-blockchain".into());
|
||||
}
|
||||
argv
|
||||
}
|
||||
|
||||
/// The exact argv used to spawn `monero-wallet-rpc`. Digest login is
|
||||
|
|
@ -487,9 +491,11 @@ impl WalletChild {
|
|||
ChainSource::Local {
|
||||
monerod_bin,
|
||||
datadir,
|
||||
prune,
|
||||
} => {
|
||||
ensure_parent(datadir)?;
|
||||
let argv = Self::monerod_argv(monerod_bin, datadir, DEFAULT_MONEROD_RPC_PORT);
|
||||
let argv =
|
||||
Self::monerod_argv(monerod_bin, datadir, DEFAULT_MONEROD_RPC_PORT, *prune);
|
||||
let child = spawn(&argv, "monerod")?;
|
||||
let mut guard = self
|
||||
.monerod
|
||||
|
|
@ -497,7 +503,11 @@ impl WalletChild {
|
|||
.map_err(|e| ChildError(format!("monerod lock: {e}")))?;
|
||||
*guard = Some(child);
|
||||
}
|
||||
ChainSource::InProcessCuprate { datadir } => self.start_in_process_daemon(datadir)?,
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir,
|
||||
network,
|
||||
prune,
|
||||
} => self.start_in_process_daemon(datadir, *network, *prune)?,
|
||||
ChainSource::None | ChainSource::Remote { .. } => {}
|
||||
}
|
||||
|
||||
|
|
@ -584,15 +594,25 @@ impl WalletChild {
|
|||
/// node answers), so this works from the TUI's blocking thread *and* from an
|
||||
/// SDK async context. It is the same shape as the SOCKS readiness wait
|
||||
/// above: no daemon, no wallet child.
|
||||
fn start_in_process_daemon(&self, datadir: &Path) -> Result<()> {
|
||||
fn start_in_process_daemon(
|
||||
&self,
|
||||
datadir: &Path,
|
||||
network: ChainNetwork,
|
||||
prune: bool,
|
||||
) -> Result<()> {
|
||||
// Feature first: in a build without it, a datadir complaint would be a
|
||||
// misleading answer to "why is there no daemon".
|
||||
if !crate::cuprate::available() {
|
||||
return Err(ChildError(crate::cuprate::NO_FEATURE_MSG.into()));
|
||||
}
|
||||
create_dir_700(datadir).map_err(|e| ChildError(format!("chain datadir: {e}")))?;
|
||||
let node = CuprateNode::launch(datadir, DEFAULT_MONEROD_RPC_PORT)
|
||||
.map_err(|e| ChildError(format!("in-process daemon: {e}")))?;
|
||||
let node = CuprateNode::launch(
|
||||
datadir,
|
||||
DEFAULT_MONEROD_RPC_PORT,
|
||||
network.cuprate_toml(),
|
||||
prune,
|
||||
)
|
||||
.map_err(|e| ChildError(format!("in-process daemon: {e}")))?;
|
||||
let mut guard = self
|
||||
.cuprate
|
||||
.lock()
|
||||
|
|
@ -729,6 +749,7 @@ impl ChildConfig {
|
|||
ChainSource::Local {
|
||||
monerod_bin,
|
||||
datadir,
|
||||
..
|
||||
} => {
|
||||
if monerod_bin.as_os_str().is_empty() {
|
||||
return Err(ChildError("monerod path required for a local node".into()));
|
||||
|
|
@ -739,7 +760,7 @@ impl ChildConfig {
|
|||
));
|
||||
}
|
||||
}
|
||||
ChainSource::InProcessCuprate { datadir } => {
|
||||
ChainSource::InProcessCuprate { datadir, .. } => {
|
||||
if datadir.as_os_str().is_empty() {
|
||||
return Err(ChildError(
|
||||
"chain data dir required for an in-process daemon".into(),
|
||||
|
|
@ -949,14 +970,22 @@ fn source_to_json(source: &ChainSource) -> serde_json::Value {
|
|||
ChainSource::Local {
|
||||
monerod_bin,
|
||||
datadir,
|
||||
prune,
|
||||
} => serde_json::json!({
|
||||
"kind": "local",
|
||||
"monerod_bin": monerod_bin.display().to_string(),
|
||||
"datadir": datadir.display().to_string(),
|
||||
"prune": prune,
|
||||
}),
|
||||
ChainSource::InProcessCuprate { datadir } => serde_json::json!({
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir,
|
||||
network,
|
||||
prune,
|
||||
} => serde_json::json!({
|
||||
"kind": "cuprate",
|
||||
"datadir": datadir.display().to_string(),
|
||||
"network": network.dir_name(),
|
||||
"prune": prune,
|
||||
}),
|
||||
ChainSource::Remote { host, port } => serde_json::json!({
|
||||
"kind": "remote",
|
||||
|
|
@ -989,6 +1018,7 @@ fn source_from_json(value: &serde_json::Value) -> Result<ChainSource> {
|
|||
Ok(ChainSource::Local {
|
||||
monerod_bin: PathBuf::from(monerod_bin),
|
||||
datadir: PathBuf::from(datadir),
|
||||
prune: value.get("prune").and_then(|v| v.as_bool()).unwrap_or(false),
|
||||
})
|
||||
}
|
||||
"cuprate" => {
|
||||
|
|
@ -999,8 +1029,15 @@ fn source_from_json(value: &serde_json::Value) -> Result<ChainSource> {
|
|||
.ok_or_else(|| {
|
||||
ChildError("stored in-process chain source has no data dir".into())
|
||||
})?;
|
||||
let network = match value.get("network").and_then(|v| v.as_str()) {
|
||||
Some("mainnet") => ChainNetwork::Mainnet,
|
||||
_ => ChainNetwork::Testnet,
|
||||
};
|
||||
let prune = value.get("prune").and_then(|v| v.as_bool()).unwrap_or(false);
|
||||
Ok(ChainSource::InProcessCuprate {
|
||||
datadir: PathBuf::from(datadir),
|
||||
network,
|
||||
prune,
|
||||
})
|
||||
}
|
||||
"remote" => {
|
||||
|
|
@ -1144,6 +1181,7 @@ mod tests {
|
|||
ChainSource::Local {
|
||||
monerod_bin: monerod,
|
||||
datadir: dir.join("monerod-data"),
|
||||
prune: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1589,6 +1627,7 @@ mod tests {
|
|||
&PathBuf::from("/usr/bin/monerod"),
|
||||
&datadir,
|
||||
DEFAULT_MONEROD_RPC_PORT,
|
||||
false,
|
||||
);
|
||||
let pairs: Vec<(&str, &str)> = argv
|
||||
.windows(2)
|
||||
|
|
@ -1748,6 +1787,8 @@ mod tests {
|
|||
fn in_process_source(dir: &Path) -> ChainSource {
|
||||
ChainSource::InProcessCuprate {
|
||||
datadir: dir.join("chain"),
|
||||
network: ChainNetwork::Testnet,
|
||||
prune: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1855,6 +1896,8 @@ mod tests {
|
|||
let empty = ChildConfig {
|
||||
source: ChainSource::InProcessCuprate {
|
||||
datadir: PathBuf::new(),
|
||||
network: ChainNetwork::Testnet,
|
||||
prune: false,
|
||||
},
|
||||
..ChildConfig::default()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1138,9 +1138,10 @@ fn chain_source_labels_name_what_the_child_dials() {
|
|||
ChainSource::Local {
|
||||
monerod_bin: PathBuf::from("/usr/bin/monerod"),
|
||||
datadir: PathBuf::from("/var/lib/onionwire"),
|
||||
prune: false,
|
||||
}
|
||||
.label(),
|
||||
"local node"
|
||||
"local full node"
|
||||
);
|
||||
assert_eq!(
|
||||
ChainSource::Remote {
|
||||
|
|
@ -1226,6 +1227,7 @@ fn child_settings_round_trip_sealed_and_keep_the_creds() {
|
|||
local.source = ChainSource::Local {
|
||||
monerod_bin: PathBuf::new(),
|
||||
datadir: PathBuf::from("/var/lib/onionwire"),
|
||||
prune: false,
|
||||
};
|
||||
let err = local.validate().expect_err("a local node needs monerod");
|
||||
assert!(err.to_string().contains("monerod path required"), "{err}");
|
||||
|
|
@ -1265,7 +1267,7 @@ async fn an_in_process_cuprate_node_answers_the_typed_daemon_client() {
|
|||
let addr = format!("127.0.0.1:{port}");
|
||||
let budget = std::time::Duration::from_secs(5);
|
||||
|
||||
let mut node = onionwire::cuprate::CuprateNode::launch(&datadir, port)
|
||||
let mut node = onionwire::cuprate::CuprateNode::launch(&datadir, port, "Testnet", false)
|
||||
.expect("launch the in-process testnet daemon");
|
||||
|
||||
// `launch` returns with the services started; the RPC listener can still be
|
||||
|
|
|
|||
Loading…
Reference in a new issue