forked from AleoNet/snarkOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version bump to 4, updates ping message format
- Loading branch information
Showing
8 changed files
with
86 additions
and
15 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
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,51 @@ | ||
#!/bin/bash | ||
# USAGE examples: | ||
# CLI with env vars: VALIDATOR_PRIVATE_KEY=APrivateKey1... ./run-validator.sh | ||
# CLI with prompts for vars: ./run-validator.sh | ||
|
||
# If the env var VALIDATOR_PRIVATE_KEY is not set, prompt for it | ||
if [ -z "${VALIDATOR_PRIVATE_KEY}" ] | ||
then | ||
read -r -p "Enter the Aleo Validator account private key: " | ||
VALIDATOR_PRIVATE_KEY=$REPLY | ||
fi | ||
|
||
if [ "${VALIDATOR_PRIVATE_KEY}" == "" ] | ||
then | ||
VALIDATOR_PRIVATE_KEY="APrivateKey1zkp8cC4jgHEBnbtu3xxs1Ndja2EMizcvTRDq5Nikdkukg1p" | ||
fi | ||
|
||
COMMAND="cargo run --release -- start --nodisplay --validator ${VALIDATOR_PRIVATE_KEY}" | ||
|
||
for word in $*; | ||
do | ||
COMMAND="${COMMAND} ${word}" | ||
done | ||
|
||
function exit_node() | ||
{ | ||
echo "Exiting..." | ||
kill $! | ||
exit | ||
} | ||
|
||
trap exit_node SIGINT | ||
|
||
echo "Running an Aleo Validator node..." | ||
$COMMAND & | ||
|
||
while : | ||
do | ||
echo "Checking for updates..." | ||
git stash | ||
rm Cargo.lock | ||
STATUS=$(git pull) | ||
|
||
if [ "$STATUS" != "Already up to date." ]; then | ||
echo "Updated code found, rebuilding and relaunching validator" | ||
cargo clean | ||
kill -INT $!; sleep 2; $COMMAND & | ||
fi | ||
|
||
sleep 1800; | ||
done |