Clean up .configured flag handling to work with an external identity keypair (#4579)

automerge
This commit is contained in:
Michael Vines 2019-06-06 14:51:48 -07:00 committed by Grimes
parent 194491ae96
commit 1c765124e7
2 changed files with 14 additions and 11 deletions

View File

@ -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

View File

@ -94,7 +94,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
@ -118,7 +118,7 @@ setup_validator_accounts() {
$solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \
create-validator-storage-account "$node_pubkey" "$storage_pubkey" || return $?
touch "$node_keypair_path".configured
touch "$configured_flag"
fi
$solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \
@ -146,7 +146,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 "$node_lamports" || return $?
@ -155,7 +155,7 @@ setup_replicator_account() {
$solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \
create-replicator-storage-account "$node_pubkey" "$storage_pubkey" || return $?
touch "$node_keypair_path".configured
touch "$configured_flag"
fi
$solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \
@ -257,6 +257,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"
@ -294,6 +295,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
@ -313,6 +315,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"
@ -383,8 +386,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