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

Add pauses in the demo #4

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ docker run --name zebra-node --network zcash-network -p 18232:18232 qedit/zebra-
Here are the 3 options (No parameters will default to the first configuration)

```bash
docker run --network zcash-network -e ZCASH_NODE_ADDRESS=127.0.0.1 -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
docker run --network zcash-network -e ZCASH_NODE_ADDRESS=zebra-node -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
docker run --network zcash-network -e ZCASH_NODE_ADDRESS=<Domain> -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=127.0.0.1 -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=zebra-node -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
docker run -it --network zcash-network -e ZCASH_NODE_ADDRESS=<Domain> -e ZCASH_NODE_PORT=18232 -e ZCASH_NODE_PROTOCOL=http zcash_tx_tool
```
The '-it' parameter was added to allow the demo to be interactive.
14 changes: 14 additions & 0 deletions src/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::components::rpc_client::reqwest::ReqwestRpcClient;
use crate::prelude::*;
use crate::components::wallet::Wallet;
use crate::config::AppConfig;
use std::io::{self, Write};


/// Run the E2E test
Expand Down Expand Up @@ -61,6 +62,8 @@ impl Runnable for TestCmd {
let mut balances = TestBalances::get(&mut wallet);
print_balances("=== Initial balances ===", balances);

pause();

// --------------------- Shield miner's reward ---------------------

let shielding_tx = create_shield_coinbase_tx(miner, coinbase_txid, &mut wallet);
Expand All @@ -69,6 +72,8 @@ impl Runnable for TestCmd {
let expected_delta = TestBalances::new(500_000_000 /*coinbase_reward*/, 0);
balances = check_balances("=== Balances after shielding ===", balances, expected_delta, &mut wallet);

pause();

// --------------------- Create transfer ---------------------

let amount_to_transfer_1: i64 = 2;
Expand All @@ -78,9 +83,18 @@ impl Runnable for TestCmd {

let expected_delta = TestBalances::new(-amount_to_transfer_1, amount_to_transfer_1);
check_balances("=== Balances after transfer ===", balances, expected_delta, &mut wallet);

pause();
}
}

fn pause() {
print!("Press Enter to continue the demo...");
io::stdout().flush().unwrap();
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
}

fn prepare_test(config: &Reader<AppConfig>, wallet: &mut Wallet, rpc_client: &mut ReqwestRpcClient) -> TxId {
wallet.reset();
sync_from_height(config.chain.nu5_activation_height, wallet, rpc_client);
Expand Down
Loading