-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3465 from dsiganos/fix_node_wrapper_network_params
Fix broken cli commands: wallet_create, wallet_list (issue #3447), diagnostics (issue #3452) and other CLI commands The wallet_create and wallet_list CLI commands were broken. Probably many CLI commands were broken. The problem was that inactive_node class only worked in dev network and inactive_node is used in a lot of CLI commands. In other words the CLI comamnds using inactive_node could not work in live, beta or test networks. I fixed the diagnostics CLI command so that I could write a test script for the wallet commands. I introduced the initialize CLI command to initialize the data folder, which was also need in order to write a test case for the wallet commands. I introduced the CLI command debug_block_dump to print ledger blocks so that I can check that initialize commands works correctly for the different networks (live, beta, test).
- Loading branch information
Showing
9 changed files
with
156 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/data.systest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
for script in *.sh; do | ||
./$script; | ||
done | ||
|
||
echo All systest passed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
DATADIR=data.systest | ||
|
||
SEED=CEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEEDCEED | ||
|
||
# the caller should set the env var NANO_NODE_EXE to point to the nano_node executable | ||
# if NANO_NODE_EXE is unser ot empty then "../../build/nano_node" is used | ||
NANO_NODE_EXE=${NANO_NODE_EXE:-../../build/nano_node} | ||
|
||
clean_data_dir() { | ||
rm -f $DATADIR/log/log_*.log | ||
rm -f $DATADIR/wallets.ldb* | ||
rm -f $DATADIR/data.ldb* | ||
rm -f $DATADIR/config-*.toml | ||
} | ||
|
||
mkdir -p $DATADIR/log | ||
clean_data_dir | ||
|
||
# initialise data directory | ||
$NANO_NODE_EXE --initialize --data_path $DATADIR | ||
|
||
# create a wallet and store the wallet ID | ||
wallet_id=`$NANO_NODE_EXE --wallet_create --data_path $DATADIR --seed $SEED` | ||
|
||
# decrypt the wallet and check the seed | ||
$NANO_NODE_EXE --wallet_decrypt_unsafe --wallet $wallet_id --data_path $DATADIR | grep -q "Seed: $SEED" | ||
|
||
# list the wallet and check the wallet ID | ||
$NANO_NODE_EXE --wallet_list --data_path $DATADIR | grep -q "Wallet ID: $wallet_id" | ||
|
||
# if it got this far then it is a pass | ||
echo $0: PASSED | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
DATADIR=data.systest | ||
|
||
# the caller should set the env var NANO_NODE_EXE to point to the nano_node executable | ||
# if NANO_NODE_EXE is unser ot empty then "../../build/nano_node" is used | ||
NANO_NODE_EXE=${NANO_NODE_EXE:-../../build/nano_node} | ||
|
||
clean_data_dir() { | ||
rm -f "$DATADIR"/log/log_*.log | ||
rm -f "$DATADIR"/wallets.ldb* | ||
rm -f "$DATADIR"/data.ldb* | ||
rm -f "$DATADIR"/config-*.toml | ||
} | ||
|
||
test_initialize_cmd() { | ||
netmatch="$1" | ||
netcmd="$2" | ||
netarg="$3" | ||
genesishash="$4" | ||
|
||
clean_data_dir | ||
|
||
# initialise data directory | ||
$NANO_NODE_EXE --initialize --data_path "$DATADIR" "$netcmd" "$netarg" | ||
|
||
# check that it is the live network | ||
grep -q "Active network: $netmatch" "$DATADIR"/log/log_*.log | ||
|
||
# check that the ledger file is created | ||
test -e "$DATADIR/data.ldb" | ||
$NANO_NODE_EXE --debug_block_count --data_path "$DATADIR" "$netcmd" "$netarg" | grep -q 'Block count: 1' | ||
|
||
# check the genesis block is correct | ||
$NANO_NODE_EXE --debug_block_dump --data_path "$DATADIR" "$netcmd" "$netarg" | head -n 1 | grep -qi "$genesishash" | ||
} | ||
|
||
mkdir -p "$DATADIR/log" | ||
|
||
test_initialize_cmd "live" "" "" "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948" | ||
test_initialize_cmd "live" "--network" "live" "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948" | ||
test_initialize_cmd "beta" "--network" "beta" "01A92459E69440D5C1088D3B31F4CA678BE944BAB3776C2E6B7665E9BD99BD5A" | ||
test_initialize_cmd "test" "--network" "test" "B1D60C0B886B57401EF5A1DAA04340E53726AA6F4D706C085706F31BBD100CEE" | ||
|
||
# if it got this far then it is a pass | ||
echo $0: PASSED | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters