Last active
December 28, 2018 08:24
-
-
Save kidinamoto01/5423d892b7028d2c28481edad67877eb to your computer and use it in GitHub Desktop.
verifier.bash
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
#!/bin/bash | |
echo What\'s the gentx directory? | |
read dir | |
file="/Users/suyu/Downloads/test/output.txt" | |
log="$dir"/basecoind.log | |
if [ -f "$file" ] | |
then | |
echo "output file exists" | |
rm $file | |
fi | |
if [ -f "$log" ] | |
then | |
rm $log | |
fi | |
for filename in "$dir"/config/gentx/*.json; do | |
echo "$filename" | |
addr=$(cat $filename| jq .value.msg[0].value.delegator_address -r) | |
if [ $? -eq 0 ]; then | |
echo collect | |
else | |
echo FAIL | |
break | |
fi | |
echo "$addr" | |
rm basecoind.log | |
rm -rf /Users/suyu/Downloads/test/tmp | |
iris init --home=/Users/suyu/Downloads/test/tmp --moniker=tmp --chain-id=fuxi-6000 | |
mkdir -p /Users/suyu/Downloads/test/tmp/config/gentx | |
cp $filename /Users/suyu/Downloads/test/tmp/config/gentx | |
iris add-genesis-account "$addr" 1000iris --home=/Users/suyu/Downloads/test/tmp | |
if [ $? -eq 0 ]; then | |
echo collect | |
else | |
echo FAIL | |
continue | |
fi | |
output=$(iris collect-gentxs --home=/Users/suyu/Downloads/test/tmp) | |
if [ $? -eq 0 ]; then | |
echo collect | |
else | |
echo FAIL | |
continue | |
fi | |
iris start --home=/Users/suyu/Downloads/test/tmp > basecoind.log 2>&1 & | |
sleep 10 | |
PID_SERVER=$! | |
if grep -q 'panic' basecoind.log | |
then | |
# Some Actions | |
echo "bad gentx" "$filename" >> output.txt | |
else | |
echo "good gentx" "$filename" >> output.txt | |
kill $PID_SERVER | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#!/bin/bash
echo What's the gentx directory?
read dir
file="/Users/suyu/Downloads/test/output.txt"
log="$dir"/basecoind.log
if [ -f "$file" ]
then
echo "output file exists"
rm $file
fi
if [ -f "$log" ]
then
rm $log
fi
for filename in "$dir"/config/gentx/*.json; do
echo "$filename"
done