From cd18de403c523c3f5d051eeaf3942d9524e481cf Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Thu, 6 Jun 2019 13:58:48 -0700 Subject: [PATCH] Clean up .configured flag handling to work with an external identity keypair --- book/src/testnet-participation.md | 11 ++++++----- multinode-demo/fullnode.sh | 14 ++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/book/src/testnet-participation.md b/book/src/testnet-participation.md index 0eaa7b6dfa..433ea3f3ae 100644 --- a/book/src/testnet-participation.md +++ b/book/src/testnet-participation.md @@ -119,7 +119,8 @@ $ solana-gossip --entrypoint testnet.solana.com:8001 spy Now configure a key pair for your validator by running: ```bash -$ solana-keygen -o validator-keypair.json +$ solana-keygen -o ~/validator-keypair.json +$ solana-keygen pubkey ~/validator-keypair.json ``` Then use one of the following commands, depending on your installation @@ -128,20 +129,20 @@ choice, to start the node: If this is a `solana-install`-installation: ```bash $ clear-config.sh -$ validator.sh --identity validator-keypair.json --poll-for-new-genesis-block testnet.solana.com +$ validator.sh --identity ~/validator-keypair.json --poll-for-new-genesis-block testnet.solana.com ``` Alternatively, the `solana-install run` command can be used to run the validator node while periodically checking for and applying software updates: ```bash $ clear-config.sh -$ solana-install run validator.sh -- --identity validator-keypair.json --poll-for-new-genesis-block testnet.solana.com +$ solana-install run validator.sh -- --identity ~/validator-keypair.json --poll-for-new-genesis-block testnet.solana.com ``` If you built from source: ```bash $ USE_INSTALL=1 ./multinode-demo/clear-config.sh -$ USE_INSTALL=1 ./multinode-demo/validator.sh --identity validator-keypair.json --poll-for-new-genesis-block testnet.solana.com +$ USE_INSTALL=1 ./multinode-demo/validator.sh --identity ~/validator-keypair.json --poll-for-new-genesis-block testnet.solana.com ``` #### Controlling local network port allocation @@ -164,7 +165,7 @@ accounts: ... The **identity pubkey** for your validator can also be found by running: ```bash -$ solana-keygen pubkey validator-keypair.json +$ solana-keygen pubkey ~/validator-keypair.json ``` From another console, confirm the IP address and **identity pubkey** of your validator is visible in the diff --git a/multinode-demo/fullnode.sh b/multinode-demo/fullnode.sh index 2f388b3f1a..ff8aa17019 100755 --- a/multinode-demo/fullnode.sh +++ b/multinode-demo/fullnode.sh @@ -93,7 +93,7 @@ setup_validator_accounts() { declare storage_pubkey storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path") - if [[ -f "$node_keypair_path".configured ]]; then + if [[ -f $configured_flag ]]; then echo "Vote and stake accounts have already been configured" else # Fund the node with enough tokens to fund its Vote, Staking, and Storage accounts @@ -116,7 +116,7 @@ setup_validator_accounts() { $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ create-validator-storage-account "$storage_pubkey" || return $? - touch "$node_keypair_path".configured + touch "$configured_flag" fi $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ @@ -138,7 +138,7 @@ setup_replicator_account() { declare storage_pubkey storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path") - if [[ -f "$node_keypair_path".configured ]]; then + if [[ -f $configured_flag ]]; then echo "Replicator account has already been configured" else $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" airdrop "$stake" || return $? @@ -147,7 +147,7 @@ setup_replicator_account() { $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ create-replicator-storage-account "$storage_pubkey" || return $? - touch "$node_keypair_path".configured + touch "$configured_flag" fi $solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \ @@ -248,6 +248,7 @@ if [[ $node_type = replicator ]]; then : "${identity_keypair_path:=$SOLANA_CONFIG_DIR/replicator-keypair$label.json}" storage_keypair_path="$SOLANA_CONFIG_DIR"/replicator-storage-keypair$label.json ledger_config_dir=$SOLANA_CONFIG_DIR/replicator-ledger$label + configured_flag=$SOLANA_CONFIG_DIR/replicator$label.configured mkdir -p "$SOLANA_CONFIG_DIR" [[ -r "$identity_keypair_path" ]] || $solana_keygen -o "$identity_keypair_path" @@ -284,6 +285,7 @@ elif [[ $node_type = bootstrap_leader ]]; then ledger_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger accounts_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts storage_keypair_path=$SOLANA_CONFIG_DIR/bootstrap-leader-storage-keypair.json + configured_flag=$SOLANA_CONFIG_DIR/bootstrap-leader.configured default_arg --rpc-port 8899 default_arg --rpc-drone-address 127.0.0.1:9900 @@ -303,6 +305,7 @@ elif [[ $node_type = validator ]]; then storage_keypair_path=$SOLANA_CONFIG_DIR/validator-storage-keypair$label.json ledger_config_dir=$SOLANA_CONFIG_DIR/validator-ledger$label accounts_config_dir=$SOLANA_CONFIG_DIR/validator-accounts$label + configured_flag=$SOLANA_CONFIG_DIR/validator$label.configured mkdir -p "$SOLANA_CONFIG_DIR" [[ -r "$identity_keypair_path" ]] || $solana_keygen -o "$identity_keypair_path" @@ -373,8 +376,7 @@ while true; do # keypair for the node and start all over again ( set -x - rm -rf "$ledger_config_dir" "$accounts_config_dir" \ - "$vote_keypair_path".configured "$storage_keypair_path".configured + rm -rf "$ledger_config_dir" "$accounts_config_dir" "$configured_flag" ) fi