Avoid airdropping to a validator that's already configured

This commit is contained in:
Michael Vines 2019-09-19 22:33:35 -07:00
parent 1d0be265d9
commit a4e72ac037
No known key found for this signature in database
GPG Key ID: 33F4FDEC4E0E88BD
1 changed files with 8 additions and 11 deletions

View File

@ -272,18 +272,12 @@ wallet() {
setup_validator_accounts() {
declare node_lamports=$1
if ((airdrops_enabled)); then
echo "Adding $node_lamports to validator identity account:"
(
declare fees=100 # TODO: No hardcoded transaction fees, fetch the current cluster fees
wallet airdrop $((node_lamports+fees)) lamports
) || return $?
else
echo "Validator identity account balance:"
wallet balance --lamports || return $?
fi
if ! wallet show-vote-account "$voting_keypair_path"; then
if ((airdrops_enabled)); then
echo "Adding $node_lamports to validator identity account:"
wallet airdrop "$node_lamports" lamports || return $?
fi
echo "Creating validator vote account"
wallet create-vote-account "$voting_keypair_path" "$identity_keypair_path" 1 --commission 127 || return $?
fi
@ -295,6 +289,9 @@ setup_validator_accounts() {
fi
echo "Validator storage account configured"
echo "Validator identity account balance:"
wallet balance --lamports || return $?
return 0
}