Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): Improve error message for attempting genesis with non-empty config dir #4987

Merged
merged 14 commits into from
Feb 11, 2025
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/iota/src/iota_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,12 @@ async fn start(
remote_migration_snapshots,
delegator,
)
.await?;
.await
.map_err(|_| anyhow!("Cannot run genesis with non-empty IOTA config directory: {}. \
\n\nIf you are trying to run a local network without persisting the data (so a new genesis that is \
randomly generated and will not be saved once the network is shut down), use --force-regenesis flag. \
\nIf you are trying to persist the network data and start from a new genesis, use iota genesis --help \
to see how to generate a new genesis.", config.display()))?;
}

let NetworkConfigLight {
Expand Down Expand Up @@ -795,7 +800,7 @@ async fn start(
.map_err(|_| anyhow!("Invalid indexer host and port"))?;
tracing::info!("Starting the indexer service at {indexer_address}");
// Start in writer mode
start_test_indexer(
start_test_indexer::<diesel::PgConnection>(
Some(pg_address.clone()),
fullnode_url.clone(),
ReaderWriterConfig::writer_mode(None),
Expand All @@ -806,7 +811,7 @@ async fn start(
info!("Indexer in writer mode started");

// Start in reader mode
start_test_indexer(
start_test_indexer::<diesel::PgConnection>(
Some(pg_address.clone()),
fullnode_url.clone(),
ReaderWriterConfig::reader_mode(indexer_address.to_string()),
Expand Down
Loading