Simplify commands by using keypair files
This commit is contained in:
parent
c8c0815144
commit
5e128f8cc2
|
@ -80,7 +80,7 @@ fi
|
||||||
|
|
||||||
config_dir="$SOLANA_CONFIG_DIR/validator$label"
|
config_dir="$SOLANA_CONFIG_DIR/validator$label"
|
||||||
vote_keypair_path="$config_dir"/vote-keypair.json
|
vote_keypair_path="$config_dir"/vote-keypair.json
|
||||||
stake_keypair_path=$config_dir/stake-keypair.json
|
stake_keypair_path="$config_dir"/stake-keypair.json
|
||||||
|
|
||||||
if [[ ! -f $vote_keypair_path ]]; then
|
if [[ ! -f $vote_keypair_path ]]; then
|
||||||
echo "Error: $vote_keypair_path not found"
|
echo "Error: $vote_keypair_path not found"
|
||||||
|
@ -93,20 +93,17 @@ if [[ -f $stake_keypair_path ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vote_pubkey=$($solana_keygen pubkey "$vote_keypair_path")
|
|
||||||
|
|
||||||
if ((airdrops_enabled)); then
|
if ((airdrops_enabled)); then
|
||||||
declare fees=100 # TODO: No hardcoded transaction fees, fetch the current cluster fees
|
declare fees=100 # TODO: No hardcoded transaction fees, fetch the current cluster fees
|
||||||
$solana_wallet "${common_args[@]}" airdrop $((stake_lamports+fees))
|
$solana_wallet "${common_args[@]}" airdrop $((stake_lamports+fees))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$solana_keygen new -o "$stake_keypair_path"
|
$solana_keygen new -o "$stake_keypair_path"
|
||||||
stake_pubkey=$($solana_keygen pubkey "$stake_keypair_path")
|
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
$solana_wallet "${common_args[@]}" \
|
$solana_wallet "${common_args[@]}" \
|
||||||
show-vote-account "$vote_pubkey"
|
show-vote-account "$vote_keypair_path"
|
||||||
$solana_wallet "${common_args[@]}" \
|
$solana_wallet "${common_args[@]}" \
|
||||||
delegate-stake $maybe_force "$stake_keypair_path" "$vote_pubkey" "$stake_lamports"
|
delegate-stake $maybe_force "$stake_keypair_path" "$vote_keypair_path" "$stake_lamports"
|
||||||
$solana_wallet "${common_args[@]}" show-stake-account "$stake_pubkey"
|
$solana_wallet "${common_args[@]}" show-stake-account "$stake_keypair_path"
|
||||||
|
|
||||||
|
|
|
@ -275,15 +275,15 @@ setup_validator_accounts() {
|
||||||
wallet balance || return $?
|
wallet balance || return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! wallet show-vote-account "$vote_pubkey"; then
|
if ! wallet show-vote-account "$voting_keypair_path"; then
|
||||||
echo "Creating validator vote account"
|
echo "Creating validator vote account"
|
||||||
wallet create-vote-account "$vote_pubkey" "$identity_pubkey" 1 --commission 127 || return $?
|
wallet create-vote-account "$voting_keypair_path" "$identity_keypair_path" 1 --commission 127 || return $?
|
||||||
fi
|
fi
|
||||||
echo "Validator vote account configured"
|
echo "Validator vote account configured"
|
||||||
|
|
||||||
if ! wallet show-storage-account "$storage_pubkey"; then
|
if ! wallet show-storage-account "$storage_keypair_path"; then
|
||||||
echo "Creating validator storage account"
|
echo "Creating validator storage account"
|
||||||
wallet create-validator-storage-account "$identity_pubkey" "$storage_pubkey" || return $?
|
wallet create-validator-storage-account "$identity_keypair_path" "$storage_keypair_path" || return $?
|
||||||
fi
|
fi
|
||||||
echo "Validator storage account configured"
|
echo "Validator storage account configured"
|
||||||
|
|
||||||
|
@ -346,13 +346,13 @@ while true; do
|
||||||
[[ -r "$voting_keypair_path" ]] || $solana_keygen new -o "$voting_keypair_path"
|
[[ -r "$voting_keypair_path" ]] || $solana_keygen new -o "$voting_keypair_path"
|
||||||
[[ -r "$storage_keypair_path" ]] || $solana_keygen new -o "$storage_keypair_path"
|
[[ -r "$storage_keypair_path" ]] || $solana_keygen new -o "$storage_keypair_path"
|
||||||
|
|
||||||
|
setup_validator_accounts "$node_lamports"
|
||||||
|
|
||||||
vote_pubkey=$($solana_keygen pubkey "$voting_keypair_path")
|
vote_pubkey=$($solana_keygen pubkey "$voting_keypair_path")
|
||||||
storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path")
|
storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path")
|
||||||
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
||||||
export SOLANA_METRICS_HOST_ID="$identity_pubkey"
|
export SOLANA_METRICS_HOST_ID="$identity_pubkey"
|
||||||
|
|
||||||
setup_validator_accounts "$node_lamports"
|
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
======================[ validator configuration ]======================
|
======================[ validator configuration ]======================
|
||||||
identity pubkey: $identity_pubkey
|
identity pubkey: $identity_pubkey
|
||||||
|
|
Loading…
Reference in New Issue