Skip to content

Commit

Permalink
Update the ledger directory in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
howardwu committed Nov 29, 2021
1 parent 52d5a7c commit aaad67a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ USAGE:
snarkos [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS:
--dev If the flag is set, the node will start in development mode
--display If the flag is set, the node will render a read-only display
-h, --help Prints help information
--norpc If the flag is set, the node will not initialize the RPC server
-V, --version Prints version information
OPTIONS:
--connect <connect> Specify the IP address and port of a peer to connect to
--dev <dev> Enables development mode, specify a unique ID for the local node
--miner <miner> Specify this as a mining node, with the given miner address
--network <network> Specify the network of this node [default: 2]
--node <node> Specify the IP address and port for the node server [default: 0.0.0.0:4132]
Expand All @@ -155,12 +155,12 @@ SUBCOMMANDS:

In one terminal, start the first node by running:
```
cargo run --release -- --dev --node 0.0.0.0:4135 --rpc 0.0.0.0:3035 --miner aleo1d5hg2z3ma00382pngntdp68e74zv54jdxy249qhaujhks9c72yrs33ddah
cargo run --release -- --dev 1 --node 0.0.0.0:4135 --rpc 0.0.0.0:3035 --miner aleo1d5hg2z3ma00382pngntdp68e74zv54jdxy249qhaujhks9c72yrs33ddah
```

After the first node starts, in a second terminal, run:
```
cargo run --release --dev
cargo run --release --dev 2
```

We welcome all contributions to snarkOS. Please refer to the [license](#7-license) for the terms of contributions.
Expand Down
12 changes: 6 additions & 6 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ pub struct Node {
/// Specify the verbosity of the node [options: 0, 1, 2, 3]
#[structopt(default_value = "2", long = "verbosity")]
pub verbosity: u8,
/// If the flag is set, the node will start in development mode.
/// Enables development mode, specify a unique ID for the local node.
#[structopt(long)]
pub dev: bool,
pub dev: Option<u16>,
/// If the flag is set, the node will render a read-only display.
#[structopt(long)]
pub display: bool,
Expand Down Expand Up @@ -242,9 +242,9 @@ pub struct Clean {
/// Specify the network of the ledger to remove from storage.
#[structopt(default_value = "2", long = "network")]
pub network: u16,
/// If the flag is set, only the development ledger will be removed from storage.
/// Enables development mode, specify the unique ID of the local node to clean.
#[structopt(long)]
pub dev: bool,
pub dev: Option<u16>,
}

impl Clean {
Expand All @@ -254,9 +254,9 @@ impl Clean {
}

/// Removes the specified ledger from storage.
fn remove_ledger(network: u16, is_dev: bool) -> Result<String> {
fn remove_ledger(network: u16, dev: Option<u16>) -> Result<String> {
// Construct the path to the ledger in storage.
let path = aleo_std::aleo_ledger_dir(network, is_dev);
let path = aleo_std::aleo_ledger_dir(network, dev);
// Check if the path to the ledger exists in storage.
if path.exists() {
// Remove the ledger files from storage.
Expand Down
6 changes: 5 additions & 1 deletion testing/src/client_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ impl ClientNode {
// Remove the storage artifacts after each test.
impl Drop for ClientNode {
fn drop(&mut self) {
self.server.shut_down();
// TODO (howardwu): @ljedrz to implement a wrapping scope for Display within Node/Server.
#[allow(unused_must_use)]
{
self.server.shut_down();
}

let db_path = format!("/tmp/snarkos-test-ledger-{}", self.local_addr().port());
assert!(
Expand Down

0 comments on commit aaad67a

Please sign in to comment.